getting end of url as string
Posted 18 July 2006 - 10:47 PM
can someone help me, i know how to get a site url and how to get part of a string, but what im finding difficult is getting the end of a url, for example:
from this, how would i get 'mypage' as a string?
Posted 18 July 2006 - 11:11 PM
$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/ge...cwd">getcwd</a> .
Posted 19 July 2006 - 12:56 AM
tried that and a few other work arounds and settled with using str_replace and php_self
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users