开发者

Getting the name of the page via PHP?

Say I'm at:

h开发者_如何学编程ttp://www.somewhere.com/pages/plants.php?pageid=13

I know how to get the pageid via _GET but how would I get '/pages/plants.php' ?

Thanks


check the $_SERVER['PHP_SELF'] variable

In fact, check out the entire $_SERVER array for a ton of interesting values about the server.


$_SERVER['REQUEST_URI'];

Do a print_r($_SERVER) for more values.


try

$_SERVER['PATH_INFO']

That should get you the path after the address :)


Use variables available in $_SERVER, and use parse_url() to get the needed part.


 $_SERVER['SCRIPT_NAME'] // path 

$_SERVER['SERVER_NAME'] // domain
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜