This article will introduce the usage of various parameters of the $_SERVER environment variable. Friends who need to know more can refer to this article.
$_SERVER['PHP_SELF']: The path relative to the website root directory and the PHP program name, related to the document root.
$_SERVER['HTTP_REFERER']: URL address of the previous page linked to the current page.
$_SERVER['SCRIPT_NAME']: The path relative to the root directory of the website and the name of the PHP program file.
$_SERVER['REQUEST_URI']: The URI required to access this page.
$_SERVER['SCRIPT_FILENAME']: The absolute path and file name of the currently running PHP program.
$_SERVER['PATH_TRANSLATED']: The base path of the file system (not the document root directory) where the current PHP program is located.
$_SERVER['QUERY_STRING']: Query string (the content after the first question mark ? in the URL but excluding the content after #).
$_SERVER['argv']: Arguments passed to the current PHP program.
$_SERVER['argc']: In command line mode, contains the number of command line parameters passed to the program.
$_SERVER['REQUEST_TIME']: timestamp when the request started, valid as of PHP 5.1.0.
$_SERVER['REQUEST_METHOD']: The request method when accessing the page, such as: "GET", "HEAD", "POST" or "PUT".
$_SERVER['HTTP_ACCEPT']: The content of the Accept: header of the current request.
$_SERVER['HTTP_ACCEPT_CHARSET']: The content of the Accept-Charset: header of the current request. For example: "iso-8859-1,*,utf-8".
$_SERVER['HTTP_ACCEPT_ENCODING']: The content of the Accept-Encoding: header of the current request. For example: "gzip".
$_SERVER['HTTP_ACCEPT_LANGUAGE']: The content of the Accept-Language: header of the current request. For example: "zh-cn".
$_SERVER['HTTP_CONNECTION']: The content of the Connection: header information of the current request. For example: "Keep-Alive".
$_SERVER['HTTP_HOST']: The content of the Host: header information of the current request.
$_SERVER['HTTPS']: Set to a non-empty value if the PHP program is accessed through the HTTPS protocol.
$_SERVER['PHP_AUTH_DIGEST']: When running as an Apache module, during the HTTP Digest authentication process, this variable is set to the "Authorization" HTTP header content sent by the client (for further authentication operations).
$_SERVER['PHP_AUTH_USER']: When PHP is running in Apache or IIS (PHP 5 is ISAPI) module mode, and the HTTP authentication function is being used, this variable is the username entered by the user.
$_SERVER['PHP_AUTH_PW']: When PHP is running in Apache or IIS (PHP 5 is ISAPI) module mode, and the HTTP authentication function is being used, this variable is the password entered by the user.
$_SERVER['AUTH_TYPE']: When PHP is running in Apache module mode and the HTTP authentication function is being used, this variable is the authentication type.
Server-side related
$_SERVER['DOCUMENT_ROOT']: The document root directory where the PHP program is currently running, defined in the server configuration file.
$_SERVER['GATEWAY_INTERFACE']: The version of the CGI specification used by the server, for example: "CGI/1.1".
$_SERVER['SERVER_ADDR']: The IP address of the server where the PHP program is currently running.
$_SERVER['SERVER_NAME']: The name of the server where the PHP program is currently running.
$_SERVER['SERVER_ADMIN']: SERVER_ADMIN parameter in the Apache server configuration file.
$_SERVER['SERVER_PORT']: The port used by the server. If using SSL secure connection, this value is the HTTP port set by the user.
$_SERVER['SERVER_SIGNATURE']: A string containing the server version and virtual host name.
$_SERVER['SERVER_SOFTWARE']: The string identifying the server, given in the header information when responding to the request.
$_SERVER['SERVER_PROTOCOL']: The name and version of the communication protocol when requesting the page, for example: "HTTP/1.0".
Other miscellaneous items
$_SERVER['HTTP_USER_AGENT']: The content of the User-Agent: header information of the current request. This string indicates the information of the user agent accessing the page.
$_SERVER['REMOTE_ADDR']: The IP address of the user who is browsing the current page.
$_SERVER['REMOTE_HOST']: The host name of the user who is browsing the current page.
$_SERVER['REMOTE_PORT']: The port used by users to connect to the server