Posted by lorento on 11/05/16 11:50
Use parse_url() function : http://www.php.net/function.parse-url
$url = www.foo.com/foo/bar/baz/index.php?param=1
$url_arr = explode ("//", parse_url($url))
$i = count($url_arr) - 1;
$last_dir = $url_arr[$i];
Not tested yet, but i think its work.
--
http://blog.deshot.com
http://www.cookdojo.com
J Huntley Palmer wrote:
> How may I capture the last /.../ in a url?
>
> eg.. www.foo.com/foo/bar/baz/index.php?param=1
>
> I want to capture 'baz'.
>
> Thanks
Navigation:
[Reply to this message]
|