Jump to content

getting end of url as string


erron

Recommended Posts

Don't know if there's a simpler solution (hope there is) but you could do this:

$path = 'http://www.mysite.com/example/index.php';
print substr(strrchr(dirname($path), '/'), 1); //will return example

If you want to just get the current directory (and not parse a url string), use <a href="http://pt.php.net/getcwd">getcwd</a> .

best

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.