The current complete url of php $ _ SERVER. The copy code is as follows:. $ _ SERVER [HTTP_HOST]. $ _ SERVER [PHP_SELF].?. $ _ SERVER [QUERY_STRING]; phpserver function Daquan SERVER [HTTP_ACCEPT] ** $ _ SERVER [HTTP_REFE
The code is as follows:
"Http: //". $ _ SERVER ['http _ host']. $ _ SERVER ['php _ SELF ']. "? ". $ _ SERVER ['query _ string'];
Php server functions
SERVER ["HTTP_ACCEPT"] = */*
$ _ SERVER ["HTTP_REFERER"] = http: // localhost/lianxi/
$ _ SERVER ["HTTP_ACCEPT_LANGUAGE"] = zh-cn
$ _ SERVER ["HTTP_ACCEPT_ENCODING"] = gzip, deflate
$ _ SERVER ["HTTP_USER_AGENT"] = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;. net clr 1.1.4322;. net clr 2.0.50727)
$ _ SERVER ["HTTP_HOST"] = localhost
$ _ SERVER ["HTTP_CONNECTION"] = Keep-Alive
$ _ SERVER ["PATH"] = C: \ WINDOWS \ system32; C: \ WINDOWS \ System32 \ Wbem; C: \ Program Files \ Common Files \ Adobe \ AGL; C: \ Program Files \ MySQL Server 5.0 \ bin; C: \ php \ ext
$ _ SERVER ["SystemRoot"] = C: \ WINDOWS
$ _ SERVER ["COMSPEC"] = C: \ WINDOWS \ system32 \ cmd.exe
$ _ SERVER ["PATHEXT"] =. COM;. EXE;. BAT;. CMD;. VBS;. VBE;. JS;. JSE;. WSF;. WSH
$ _ SERVER ["WINDIR"] = C: \ WINDOWS
$ _ SERVER ["SERVER_SIGNATURE"] =
Apache/2.0.55 (Win32) PHP/5.1.1 Server at localhost Port 80 \ which Server is used
$ _ SERVER ["SERVER_SOFTWARE"] = Apache/2.0.55 (Win32) PHP/5.1.1
$ _ SERVER ["SERVER_NAME"] = localhost \ SERVER name
$ _ SERVER ["SERVER_ADDR"] = 127.0.0.1
$ _ SERVER ["SERVER_PORT"] = 80 \ SERVER port
$ _ SERVER ["REMOTE_ADDR"] = 127.0.0.1
$ _ SERVER ["DOCUMENT_ROOT"] = D:/lianxi \ main directory of the website
$ _ SERVER ["SERVER_ADMIN"] = sss@163.com \ mailbox set when APACHE is installed
$ _ SERVER ["SCRIPT_FILENAME"] = D:/lianxi/servervalues. php \ absolute path of the current webpage,
$ _ SERVER ["REMOTE_PORT"] = 1076 \ remote port
$ _ SERVER ["GATEWAY_INTERFACE"] = CGI/1.1
$ _ SERVER ["SERVER_PROTOCOL"] = HTTP/1.1
$ _ SERVER ["REQUEST_METHOD"] = GET
$ _ SERVER ["QUERY_STRING"] =\\ get? Content after No.
$ _ SERVER ["REQUEST_URI"] = Example:/lianxi/servervalues. php? A = 1 & B = 2
$ _ SERVER ["SCRIPT_NAME"] = Example:/lianxi/servervalues. php
$ _ SERVER ["PHP_SELF"] =/lianxi/servervalues. php \ returns the relative path of the current webpage.
$ _ SERVER ["REQUEST_TIME"] = 1179190013 \ the unit of running time is 100,000 in milliseconds
$ _ SERVER ["argv"] = Array
$ _ SERVER ["argc"] = 0
Note: The main directory of the website that returns this result is D:/lianxi.
Foreach ($ _ SERVER as $ asd => $ values)
{
Echo ("\ $ _ SERVER [\" $ asd \ "] =". $ values ."
");
}
$ _ SERVER stores information about the current SERVER. several values are as follows: $ _ SERVER ["QUERY_STRING"], $ _ SERVER ["REQUEST_URI"], $ _ SERVER ["SCRIPT_NAME"] and $ _ SERVER ["PHP_SELF"] are often confusing. The following describes the differences between QUERY_STRING, REQUEST_URI, SCRIPT_NAME, and PHP_SELF variables in the $ _ SERVER function through examples, master the relationships between the four, so that you can obtain the required values in practical applications for your reference.
1, $ _ SERVER ["QUERY_STRING"]
Description: query string
2, $ _ SERVER ["REQUEST_URI"]
Description: the URI required to access this page
3, $ _ SERVER ["SCRIPT_NAME"]
Description: path containing the current script
4, $ _ SERVER ["PHP_SELF"]
Description: file name of the script being executed
Instance:
1, http://www.biuuu.com/(open the home page directly)
Result:
$ _ SERVER ["QUERY_STRING"] = ""
$ _ SERVER ["REQUEST_URI"] = "/"
$ _ SERVER ["SCRIPT_NAME"] = "/index. php"
$ _ SERVER ["PHP_SELF"] = "/index. php"
2, http://www.biuuu.com /? P = 222 (with query)
Result:
$ _ SERVER ["QUERY_STRING"] = "p = 222 ″
$ _ SERVER ["REQUEST_URI"] = "/? P = 222 ″
$ _ SERVER ["SCRIPT_NAME"] = "/index. php"
$ _ SERVER ["PHP_SELF"] = "/index. php"
3, http://www.biuuu.com/index.php? P = 222 & q = biuuu
Result:
$ _ SERVER ["QUERY_STRING"] = "p = 222 & q = biuuu"
$ _ SERVER ["REQUEST_URI"] = "/index. php? P = 222 & q = biuuu"
$ _ SERVER ["SCRIPT_NAME"] = "/index. php"
$ _ SERVER ["PHP_SELF"] = "/index. php"
$ _ SERVER ["QUERY_STRING"]: obtain the query statement. Which of the following statements can be obtained in the instance? Value after
$ _ SERVER ["REQUEST_URI"] gets the value after the http://www.biuuu.com, including/
$ _ SERVER ["SCRIPT_NAME"] obtains the path of the current script, for example, index. php.
$ _ SERVER ["PHP_SELF"] file name of the script currently being executed
To sum up, for QUERY_STRING, REQUEST_URI, SCRIPT_NAME, and PHP_SELF, an in-depth understanding will help us call these four values correctly in the $ _ SERVER function. Explain the differences between the four variables in the $ _ SERVER function: QUERY_STRING, REQUEST_URI, SCRIPT_NAME, and PHP_SELF.
The http://www.bkjia.com/PHPjc/320855.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320855.htmlTechArticle code is as follows: "http: //". $ _ SERVER ['http _ host']. $ _ SERVER ['php _ SELF ']. "? ". $ _ SERVER ['query _ string']; php server function Daquan SERVER [" HTTP_ACCEPT "] = */* $ _ SERVER [" HTTP_REFE...