Depth analysis of PHP server variable $ _SERVER



For a person new to PHP the language, he needs to understand there are many things to explore their meaning.Today we are here for everyone summarizes the PHP server variable $ _SERVER some of the details, hoping to play the role of some help.

1, $ _SESSION ['PHP_SELF'] - PHP server variable $ _SERVER to get the currently executing script file name

2, $ _SERVER ['SERVER_PROTOCOL'] - request a page name and version of the communication protocol.For example, "HTTP/1.0".

3, $ _SERVER ['REQUEST_TIME'] - request start timestamp.From PHP 5.1.0, and effective.And time functions the same effect.

4, $ _SERVER ['argv'] - the parameters passed to the script.I tried the next, get ways to get $ _SERVER ['argv'] [0]; post method does not give him an assignment.

5, $ _SERVER ['SERVER_NAME'] - Returns the current host name.

6, $ _SERVER ['SERVER_SOFTWARE'] - the server identification string, in response to requests given in the headers.If Microsoft-IIS/6.0

7, $ _SERVER ['REQUEST_METHOD'] - request way to access the page.For example: "GET", "HEAD", "POST", "PUT".

8, $ _SERVER ['QUERY_STRING'] - PHP server variable $ _SERVER query (query) string (URL of the first question mark? After the content).

9, $ _SERVER ['DOCUMENT_ROOT'] - where the current script document root directory.Defined in the server configuration file.Such as E: server

10, $ _SERVER ['HTTP_ACCEPT'] - PHP server variable $ _SERVER the current request the Accept: header content.

11, $ _SERVER ['HTTP_ACCEPT_CHARSET'] - the current request the Accept-Charset: header content.For example: "iso-8859-1, *, utf-8".

12, $ _SERVER ['HTTP_ACCEPT_ENCODING'] - the current request the Accept-Encoding: header content.For example: "gzip".

13, $ _SERVER ['HTTP_ACCEPT_LANGUAGE'] - the current request the Accept-Language: header content.For example: "en".

14, $ _SERVER ['HTTP_CONNECTION'] - the current request the Connection: header content.For example: "Keep-Alive".

15, $ _SERVER ['HTTP_HOST'] - PHP server variable $ _SERVER the current request the Host: header content.

16, $ _SERVER ['HTTP_REFERER'] - links to the current page's URL address of the previous page.

17, $ _SERVER ['HTTP_USER_AGENT'] - return user's browser information.You can also use get_browser () to get this information.

18, $ _SERVER ['HTTPS'] - if access via https, were set to a non-empty value, otherwise off.

19, $ _SERVER ['REMOTE_ADDR'] - the user is browsing the IP address of the current page.

20, $ _SERVER ['REMOTE_HOST'] - the user is browsing the host name of the current page.Reverse DNS is based on the user's REMOTE_ADDR.Returns 127.0.0.1 as the local test

21, $ _SERVER ['REMOTE_PORT'] - when a user connects to the server port to use.I do not pass the test the machine, do not know why.

22, $ _SERVER ['SCRIPT_FILENAME'] - the absolute path of the current name of the script.Such as the return E: serverindex.php

23, $ _SERVER ['SERVER_ADMIN'] - The PHP server variable $ _SERVER values indicate the Apache server configuration file SERVER_ADMIN parameters.If the script is running on a virtual host, then the value is the value of the virtual host

24, $ _SERVER ['SERVER_PORT'] - the server port to use.The default is "80."If you use SSL secure connection, then this value is set by the user HTTP port.

25, $ _SERVER ['SERVER_SIGNATURE'] - contains the server version and virtual host name string.

26, $ _SERVER ['PATH_TRANSLATED'] - where the current script file system (not document root) of the basic path.This is the server path to the virtual to the real image of the result.Apache 2 users can use the AcceptPathInfo On httpd.conf to define PATH_INFO.

27, $ _SERVER ['SCRIPT_NAME'] - contains the current script's path.The PHP server variable $ _SERVER need to point to your page is very useful.__FILE__ Contains the current file's absolute path and file name (for example, include file.)

28, $ _SERVER ['REQUEST_URI'] - needed to access this page URI.For example, "/ index.html".

29, $ _SERVER ['PHP_AUTH_DIGEST'] - When running as an Apache module, the HTTP Digest authentication process, this variable is set to the client to send the "Authorization" HTTP header content (for further certification operation).

30, $ _SERVER ['PHP_AUTH_USER'] - when PHP is running on Apache or IIS (PHP 5 is the ISAPI) module mode, and are using HTTP authentication this variable is the user name entered by the user.

31, $ _SERVER ['PHP_AUTH_PW'] - when PHP is running on Apache or IIS (PHP 5 is the ISAPI) module mode, and are using HTTP authentication this variable is the user password.

32, $ _SERVER ['AUTH_TYPE'] - when PHP is running in the Apache module mode, and are using HTTP authentication, PHP server variable $ _SERVER this is the type of certification.