$ _ SERVER [REQUEST_URI] is only available on the web SERVER supporting PATH_INFO. For php, it is available under apache, in php5, another $ _ SERVER is available only in php4.1.0 and later versions. $ _ SERVER [REQUEST_URI] is a type of predefined SERVER variable of the function, all operations starting with $ _ SERVER are called the predefined SERVER variable REQUEST_URI.
$ _ SERVER [REQUEST_URI] is only available on the web SERVER supporting PATH_INFO. For php, it is available under apache, in php5, another $ _ SERVER is available only in php4.1.0 and later versions. $ _ SERVER [REQUEST_URI] is a type of predefined SERVER variable of the function, all operations starting with $ _ SERVER are called the predefined SERVER variable REQUEST_URI.
$ _ SERVER ["REQUEST_URI"] is available only on web servers that support PATH_INFO
Specifically, php is available under apache, and php5 is available.
In addition, $ _ SERVER is only available in php4.1.0 and later versions.
$ _ SERVER ["REQUEST_URI"] Function
A type of predefined SERVER variables. All variables starting with $ _ SERVER are called the predefined SERVER variable REQUEST_URI. The function is to obtain the current URI, that is, the complete address path after the domain name.
For example. Is the current page a http://www.zixueku.com/plus/search.php? Kwtype = 0 & keyword = php & searchtype = titlekeyword
Echo $ _ SERVER ["REQUEST_URI"];
The result is: plus/search. php? Kwtype = 0 & keyword = php & searchtype = titlekeyword
Assume that the address of the command line is
"PHP_SELF"
The file name of the script being executed, which is related to document root. For example, using $ _ SERVER ['php _ SELF '] in a script with a URL address of http://www.jb51.net/test.php/foo.bar will get the result of/test. PHP/foo. bar. The _ FILE _ constant contains the absolute path and FILE name of the current (such as include) FILE.
"SCRIPT_NAME"
The path that contains the current script. This is useful when the page needs to point to itself. _ FILE _ contains the absolute path and FILE name of the current FILE (for example, including the FILE ).
The main reasons are as follows: $ _ SERVER ['php _ SELF ']? $ _ SERVER ['php _ SELF ']: $ _ SERVER ['script _ name'];
The better reason is:
Today, when I installed a set of PHP programs on the Dreamhost, I found that there would be an additional cgi-system address, but the config of the program has no problem, after checking the information, we found the problem caused by different SCRIPT_NAME and PHP_SELF.
Generally, the website hosting $ _ SERVER ['script _ name'] and $ _ SERVER ['php _ SELF '] on the current machine cannot be seen as different, because most PHP does not run in CGI Mode.
However, PHP on DreamHost runs in CGI Mode, and there are obvious differences between the two.
Echo $ _ SERVER ['script _ name']; // (/cgi-system/php. cgi)
Echo $ _ SERVER ['php _ SELF ']; // (/admin/test. PHP)
Found a description from the http://lists.nyphp.org/pipermail/talk/2005-July/015339.html. Said by foreigners.
SCRIPT_NAME solves all the problems mentioned
In this thread-it's just the script name, without any extra garbage
That might be tacked on by the user. PHP_SELF explicitly provided des that
Extra garbage, so solutions in this thread that involve stripping
Garbage off of PHP_SELF to make it safe are really, really missing
Point-just use SCRIPT_NAME instead. Please don't use form action = "";
According to the spec, what the browser does with that is undefined, so
Even if it works in current browsers, it might not work in future ones