: This article mainly introduces ultra-Global Arrays (pre-defined variables). For more information about PHP tutorials, see.
Server variables: |
$ _ SERVER |
Environment variable: |
$ _ ENV |
Http get variable: |
$ _ GET |
Http post variable: |
$ _ POST |
Request variable: |
$ _ REQUEST |
HTTP file Upload variable: |
$ _ FILES |
HTTP Cookies: |
$ _ COOKIE |
Session variable: |
$ _ SESSION |
Global variable: |
$ _ GLOBALS |
SERVER variable: $ _ SERVER
$ _ SERVER is an array containing header information (header), path, and script locations. The object of the array is created by the web server. It is not guaranteed that all servers can generate all information. the server may ignore some information or generate new information not listed below. This is an automatic global variable. This only means that it is valid in all scripts. Global $ _ SERVER is not required in functions or methods;
PHP_SELF: file name of the script being executed
DOCUMENT_ROOT: root directory of the document where the script is currently running
REMOTE_ADDR: the IP address of the user browsing the current page.
$value)echo "{$key}=>{$value}
";
Output:
33HTTP_HOST => localhost
HTTP_C/span>
HTTP_ACCEPT => text/html, application/xhtml + xml, application/xml; q = 0.9, image/webp, */*; q = 0.8
HTTP_USER_AGENT => Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
HTTP_ACCEPT_ENCODING => gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE => zh-CN, zh; q = 0.8
PATH => C: \ ProgramData \ Oracle \ Java \ javapath; C: \ Program Files (x86) \ Intel \ iCLS Client \; C: \ Program Files \ Intel \ iCLS Client \; C: \ Program Files (x86) \ NVIDIA Corporation \ PhysX \ Common; C: \ WINDOWS \ system32; C: \ WINDOWS; C: \ WINDOWS \ System32 \ Wbem; C: \ WINDOWS \ System32 \ WindowsPowerShell \ v1.0 \; C: \ Program Files \ Intel (R) Management Engine Components \ DAL; C: \ Program Files \ Intel (R) Management Engine Components \ ept; C: \ Program Files (x86) \ Intel (R) Management Engine Components \ DAL; C: \ Program Files (x86) \ Intel (R) Management Engine Components \ ept; C: \ Program Files \ Lenovo \ Bluetooth Software \; C: \ Program Files \ Lenovo \ Bluetooth Software \ syswow64; C: \ Program Files (x86) \ Lenovo Home \; % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin; c: \ Program Files (x86) \ Windows Kits \ 8.1 \ Windows Performance Toolkit \; C: \ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn \; C: \ Program Files \ MySQL Server 5.5 \ bin;
SystemRoot => C: \ WINDOWS
COMSPEC => C: \ WINDOWS \ system32 \ cmd.exe
PATHEXT =>. COM;. EXE;. BAT;. CMD;. VBS;. VBE;. JS;. JSE;. WSF;. WSH;. MSC
WINDIR => C: \ WINDOWS
SERVER_SIGNATURE => Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80
SERVER_SOFTWARE => Apache/2.4.9 (Win32) PHP/5.5.12
SERVER_NAME => localhost
SERVER_ADDR = >:: 1
SERVER_PORT => 80
REMOTE_ADDR = >:: 1
DOCUMENT_ROOT => C:/wamp/www/
REQUEST_SCHEME => http
C/span>
C/wamp/www/
Server _ admin => admin@example.com
SCRIPT_FILENAME => C:/wamp/www/array/arr1.php
REMOTE_PORT = & gt; 21721
GATEWAY_INTERFACE = & gt; CGI/1.1
SERVER_PROTOCOL => HTTP/1.1
REQUEST_METHOD => GET
QUERY_STRING =>
REQUEST_URI =>/array/arr1.php
SCRIPT_NAME =>/array/arr1.php
PHP_SELF =>/array/arr1.php
REQUEST_TIME_FLOAT => 1452865977.555
Request time => 1452865977
Environment variable: $ _ ENV
When the parser is running, these variables change from environment variables to PHP global variable namespace ). Many of them are determined by the system running PHP. A complete list is impossible. Check the system documentation to determine its specific environment variables.
This is an automatic global variable. It is valid in all scripts. Global $ _ ENV is not required in functions or methods;
The above introduces the Super Global Array (pre-defined variables), including the content, hope to be helpful to friends who are interested in the PHP Tutorial.