开发者

Remove all before certain delimiter starting at end of string PHP

开发者 https://www.devze.com 2022-12-27 08:53 出处:网络
Hey, I need help isolating part of a url in PHP.开发者_Go百科 say I have http://www.test.com/something/something/important/

Hey, I need help isolating part of a url in PHP.

开发者_Go百科

say I have

http://www.test.com/something/something/important/

How could I isolate the "important"

Thanks!


Use the basename() function for that.

echo basename('http://www.test.com/something/something/important/');

Result:

important


<?php
$url ='http://www.test.com/something/something/important/';
echo basename($url);
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号