How do you consistently retrieve the path information from the query in php? (/index.php/foo/bar)
Basically if the user requests:
index.php/foo/bar
I need开发者_如何学Go "/foo/bar" and for
index.php
I need "" or "/"
I couldn't find any information on google because I don't know what this is called (path info got me the pathinfo() function)
I found PHP_SELF returns differently if there is path info than if there is no info
The portion after your file name /index.php
is called the path info (see Apache’s AcceptPathInfo
directive). You can access that information with the $_SERVER['PATH_INFO']
variable. And if you want the full requested URL path with query, use $_SERVER['REQUEST_URI']
.
精彩评论