PHP pre-defined variable $_server
$_server is an array that contains such things as the head (headers), Path (paths), and script location (scripts locations). The entity of the array is created by the Web server, and there is no guarantee that all the servers will produce all the information. Here are some common things to do:
The absolute path to the current script, and the absolute path to my local index.php script is: f:/phpstudy/www/test/index.php.
$_server[' script_filename '] = f:/phpstudy/www/test/index.php
The document root directory where the currently running script is located, as defined in the server configuration file:
$_server[' document_root '] = f:/phpstudy/www/test
Name of the server host where the script is currently running (domain name):
$_server[' server_name '] = www.test.com
Host name of the request (domain name):
$_server[' http_host '] = www.test.com
IP address of server host:
$_server[' server_addr '] = 127.0.0.1
Port number of the server host:
$_server[' server_port '] = 80
The request method for accessing the page, which is currently get mode:
$_server[' request_method '] = = GET
Browse the user host IP address of the current page:
$_server[' remote_addr '] = 127.0.0.1
Browse current page User host Connection server useful port number:
$_server[' remote_port '] = 61040
The parameter passed by the request, index.php? What's behind:
$_server[' query_string '] = a=90
Timestamp at the start of the request:
$_server[' Request_time ']=> 1488630127
The path to the current script, the URL required to access the page, and the file name of the currently executing script, related to document root:
$_server[' script_name '] =/index.php
$_server[' Request_uri '] =/index.php
$_server[' php_self '] =/index.php
PHP pre-defined variable $_server