Copy CodeThe code is as follows:
"http://". $_server [' http_host '].$_server[' php_self ']. "?". $_server[' query_string '];
PHP Server Functions Daquan
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; C:\WINDOWS\System32\Wbem; C:\Program Files\Common Files\adobe\agl; C:\Program files\mysql\mysql Server 5.0\bin; C:\php; 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 \ \ What servers to use
$_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 \ \ site's home directory
$_server["server_admin"]=sss@163.com \ \ e-mail set when installing Apache
$_server["Script_filename"]=d:/lianxi/lianxi/servervalues.php \ \ The absolute path of the current page,
$_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? The contents after the number
$_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 page.
$_server["Request_time"]=1179190013 \ \ Run time unit is one out of 10,000 milliseconds
$_server["argv"]=array
$_server["ARGC"]=0
Description: The home directory of the Web site that returned this result run is D:/lianxi
foreach ($_server as $ASD = $values)
{
Echo ("\$_server[\" $ASD \ "]=". $values. "
");
}
$_server stores current server information, with several values such as $_server["Query_string"],$_server["Request_uri"],$_server["Script_name" and $_server[" Php_self "] often easy to confuse, the following through an example of the $_server function in the query_string,request_uri,script_name and php_self variable differences, master the relationship between the four, so that in practical application of the right to obtain Take the desired value for reference.
1,$_server["Query_string"]
Description: A string that queries (query)
2,$_server["Request_uri"]
Description: The URI required to access this page
3,$_server["Script_name"]
Description: Contains the path of the current script
4,$_server["Php_self"]
Description: The file name of the currently executing script
Instance:
1,http://www.biuuu.com/(open homepage directly)
Results:
$_server["query_string"] = ""
$_server["Request_uri"] = "/"
$_server["script_name"] = "/index.php"
$_server["php_self"] = "/index.php"
2,http://www.biuuu.com/?p=222 (with inquiry)
Results:
$_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
Results:
$_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"] gets the query statement, in the instance, gets the following value
$_server["Request_uri"] gets the value after http://www.biuuu.com, including/
$_server["Script_name"] gets the path to the current script, such as: index.php
$_server["Php_self"] The file name of the script that is currently executing
To summarize, for Query_string,request_uri,script_name and php_self, deep understanding will help us to correctly invoke these four values in the $_server function. The differences between the four variables are mastered by Query_string,request_uri,script_name and php_self in the $_server function by example.
The above describes the server application error PHP $_server the current full URL of the wording, including the server application error content, I hope the PHP tutorial interested in a friend helpful.