Server and execution environment information.
$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here.
示例:加粗的为重点关注
访问 127.0.0.1/index.php?id=123&name=xiang
-
PHP_SELF /index.php
- The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/foo/bar.php would be /foo/bar.php.
- argv -
- argc -
- GATEWAY_INTERFACE CGI/1.1
-
SERVER_ADDR 127.0.0.1
- The IP address of the server under which the current script is executing.
-
SERVER_NAME localhost
- The name of the server host under which the current script is executing.
- SERVER_SOFTWARE Apache/2.2.22 (Win64) PHP/5.3.13
- SERVER_PROTOCOL HTTP/1.1
- SERVER_ADMIN myemail@personal.us
- SERVER_PORT 80
- SERVER_SIGNATURE
-
REQUEST_URI /index.php?id=123&name=xiang
- The URI which was given in order to access this page
- REQUEST_METHOD GET
- REQUEST_TIME 1361542579
- REQUEST_TIME_FLOAT -
-
QUERY_STRING id=123&name=xiang
- The query string, if any, via which the page was accessed.
- DOCUMENT_ROOT E:/web/
- HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
- HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.3
- HTTP_ACCEPT_ENCODING gzip,deflate,sdch
- HTTP_ACCEPT_LANGUAGE fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
- HTTP_CONNECTION keep-alive
- HTTP_HOST localhost (来自于HTTP请求的头信息)
- Contents of the Host: header from the current request, if there is one.
- HTTP_REFERER http://localhost/ (来自于HTTP请求的头信息)
- The address of the page (if any) which referred the user agent to the current page. This is set by the user agent.
- HTTP_USER_AGENT Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17
- HTTPS -
-
REMOTE_ADDR 127.0.0.1
- The IP address from which the user is viewing the current page.
- REMOTE_HOST -
- REMOTE_PORT 65037
- REMOTE_USER -
- REDIRECT_REMOTE_USER -
- SCRIPT_FILENAME E:/web/index.php
- PATH_TRANSLATED -
-
SCRIPT_NAME /index.php
- Contains the current script's path. This is useful for pages which need to point to themselves.
- PHP_AUTH_DIGEST -
- PHP_AUTH_USER -
- PHP_AUTH_PW -
- AUTH_TYPE -
- PATH_INFO -
- ORIG_PATH_INFO -