Php trim string at a particular character

前端 未结 7 1385
花落未央
花落未央 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 19:09

    This may be overkill for what you are trying to do, but if you want to break apart a URL into pieces, try the PHP function parse_url. Here's the PHP manual page.

    You'd then want the "path" portion of the resulting array.

提交回复
热议问题