PHP super global variable
$ GLOBALS
Contains a reference to a variable that is valid globally for each current script. The key of the array is the name of the global variable. $ GLOBALS array exists from PHP 3.
$ _ SERVER
Variables are set by the Web server or directly associated with the execution environment of the current script. Similar to the old $ HTTP_SERVER_VARS array (still valid, but not used ).
$ _ GET
Variables submitted to the script through the http get method. Similar to the old $ HTTP_GET_VARS array (still valid, but not used ).
$ _ POST
Variables submitted to the script through the http post method. Similar to the old $ HTTP_POST_VARS array (still valid, but not used ).
$ _ COOKIE
Variables submitted to the script through HTTP Cookies. Similar to the old $ HTTP_COOKIE_VARS array (still valid, but not used ).
$ _ FILES
Variables submitted to the script by uploading the http post file. Similar to the old array $ HTTP_POST_FILES array (still valid, but not used ). For more information, see POST upload.
$ _ ENV
Variables submitted to the script in the execution environment. Similar to the old $ HTTP_ENV_VARS array (still valid, but not used ).
$ _ REQUEST
This array is not trustworthy because the GET, POST, and COOKIE mechanisms are used to submit scripts to variables. All the existence or not of the variables contained in the array and the order of the variables are defined according to the variables_order configuration instructions in php. ini. This array does not directly simulate earlier versions of PHP 4.1.0. See.
* ***** Since PHP 4.3.0, the file information in $ _ FILES no longer exists in $ _ REQUEST. *****
$ _ SESSION
The variable currently registered to the script session. Similar to the old $ HTTP_SESSION_VARS array (still valid, but not used ).
SERVER variable $ _ SERVER details:
1. $ _ SERVER ['php _ SELF '] -- get the file name of the script being executed
2. $ _ SERVER ['server _ Protocol'] -- name and version of the communication PROTOCOL when requesting the page. For example, "HTTP/1.0 ".
3. $ _ SERVER ['request _ time'] -- the timestamp at the start of the REQUEST. Valid from PHP 5.1.0. The same effect as the time function.
4. $ _ SERVER ['argv'] -- parameters passed to the script. I tried the get method to get $ _ SERVER ['argv'] [0]. The post method cannot assign a value to him.
5. $ _ SERVER ['server _ name'] -- returns the current host NAME.
6. $ _ SERVER ['server _ soft'] -- the string of the SERVER identifier, which is provided in the header information in the Response Request. For example, Microsoft-IIS/6.0
7. $ _ SERVER ['request _ method'] -- the request method used to access the page. For example, "GET", "HEAD", "POST", and "PUT ".
8. $ _ SERVER ['query _ string'] -- query string (the first question mark in the URL? ).
9. $ _ SERVER ['document _ root'] -- the ROOT directory of the DOCUMENT where the script is currently running. Defined in the server configuration file. E: \ server
10. $ _ SERVER ['HTTP _ ACCEPT '] -- Accept of the current request: header information.
11. $ _ SERVER ['HTTP _ ACCEPT_CHARSET '] -- Accept-Charset of the current request: content of the header information. Example: "iso-8859-1, *, UTF-8 ".
12. $ _ SERVER ['HTTP _ ACCEPT_ENCODING '] -- Accept-Encoding of the current request: content of the header information. For example, "gzip ".
13. $ _ SERVER ['HTTP _ ACCEPT_LANGUAGE '] -- Accept-Language of the current request: content of the header information. For example, "en ".
14. $ _ SERVER ['HTTP _ connection'] -- CONNECTION of the current request: content of the header information. For example, "Keep-Alive ".
15. $ _ SERVER ['HTTP _ host'] -- HOST of the current request: header information.
16. $ _ SERVER ['HTTP _ referer'] -- link to the URL of the previous page of the current page. Not all user proxies (browsers) will set this variable, and some can also manually modify HTTP_REFERER. Therefore, this variable is not always true.
17. $ _ SERVER ['HTTP _ USER_AGENT '] -- return the browser information used by the user. A typical example is Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586 ). You can also use get_browser () to obtain this information.
18. $ _ SERVER ['https'] -- If accessed through HTTPS, it is set to a non-null value; otherwise, off is returned.
19. $ _ SERVER ['remote _ ADDR '] -- browsing the IP address of the user on the current page.
20. $ _ SERVER ['remote _ host'] -- the HOST name of the user on the current page is being viewed. Reverse Domain name resolution is based on the user's REMOTE_ADDR. If the local test returns 127.0.0.1
21. $ _ SERVER ['remote _ port'] -- the PORT used by the user to connect to the SERVER. I did not pass the test on the local machine. I don't know why.
22. $ _ SERVER ['script _ filename'] -- the absolute path name of the currently executed SCRIPT. E: \ server \ index. php is returned.
23. $ _ SERVER ['server _ admin'] -- This value specifies the SERVER_ADMIN parameter in the Apache SERVER configuration file. If the script runs on a VM, the value is the value of that VM.
24. $ _ SERVER ['server _ port'] -- the PORT used by the SERVER. The default value is "80 ". If SSL secure connection is used, this value is the HTTP port set by the user.
25. $ _ SERVER ['server _ SIGNATURE '] -- a string containing the SERVER version and virtual host name.
26. $ _ SERVER ['path _ TRANSLATED '] -- the basic PATH of the file system where the current script is located (not the root directory of the document. This is the result of a virtual image to a real path on the server. Apache 2 users can use AcceptPathInfo On in httpd. conf to define PATH_INFO.
27. $ _ SERVER ['script _ name'] -- contains the path of 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 ).
28. $ _ SERVER ['request _ URI '] -- URI required to access this page. For example, "/index.html ".
29. $ _ SERVER ['php _ AUTH_DIGEST '] -- during HTTP Digest authentication when running as an Apache module, this variable is set to the "Authorization" HTTP header content sent by the client (For further authentication ).
30. $ _ SERVER ['php _ AUTH_USER '] -- when PHP runs in the Apache or IIS (PHP 5 is an ISAPI) module and is using the HTTP authentication function, this variable is the user name entered by the user.
31. $ _ SERVER ['php _ AUTH_PW '] -- when PHP runs in the Apache or IIS (PHP 5 is an ISAPI) module and is using the HTTP authentication function, this variable is the password entered by the user.
32. $ _ SERVER ['auth _ type'] -- when PHP runs in the Apache module mode and uses the HTTP authentication function, this variable is the authentication TYPE.
PHP predefined global variables $ _ FILES
Variables submitted to the script by uploading the http post file. Similar to the old array $ HTTP_POST_FILES array (still valid, but not used ). For more information, see POST upload.
The $ _ FILES array contains the following content:
<Input type = "file" name = "userfile">
$ _ FILES ['userfile'] ['name'] --- the original name of the client machine file.
$ _ FILES ['userfile'] ['type'] --- MIME type of the file, which must be supported by the browser, for example, "image/gif ".
$ _ FILES ['userfile'] ['SIZE'] --- size of the uploaded file, in bytes.
$ _ FILES ['userfile'] ['tmp _ name'] --- temporary file name stored on the server after the file is uploaded.
$ _ FILES ['userfile'] ['error'] --- error Code related to the file upload. ['Error'] is added in PHP 4.2.0.
Note: Before PHP 4.1.0, the array name is $ HTTP_POST_FILES, which is not an automatic global variable like $ _ FILES. PHP 3 does not support the $ HTTP_POST_FILES array.