Php trim string at a particular character

前端 未结 7 1389
花落未央
花落未央 2021-01-11 18:32

Is there a php string function to trim a string after a particular character. I had a look on the php.net site and did a google search but couldn\'t find anything. The only

7条回答
  •  既然无缘
    2021-01-11 18:58

    You could use explode:

    $string = "/gallery/image?a=b";
    list($url,$querystring) = explode('?', $string, 2);
    

提交回复
热议问题