Common Environment system variables in php. In any development language, some variables are called system variables or environment variables. For more information, see. PHP environment variables include $ GLOBALS [], $ _ SERVER [], and $ _ GE. in any development language, some variables are called system variables or environment variables, for more information, see.
PHP environment variables include $ GLOBALS [], $ _ SERVER [], $ _ GET [], $ _ POST [], $ _ COOKIE [], $ _ FILES [], $ _ ENV [], $ _ REQUEST [], and $ _ SESSION []. $ _ GET and $ _ POST are mainly for data submitted by FORM forms. $ _ COOKIE and $ _ SESSION are mainly for client browser and server SESSION data. $ _ FILES mainly targets the data submitted during File upload. $ _ REQUEST mainly targets all REQUEST arrays in the submission form, including all content in $ _ GET, $ _ POST, and $ _ COOKIE, you can use the print_r function to output $ _ REQUEST or $ _ COOKIE for comparison.
$ _ SERVER variable
Is a global PHP environment variable that contains server-side information. $ HTTP_SERVER_VARS is used in versions earlier than PHP4.1.0.
$ _ SERVER ['php _ SELF ']
# The file name of the script being executed, which is related to document root. In FORM, if the execution file is itself, you can use
$ _ SERVER ['query _ string']
# Obtain the query statement, that is, get '? 'Value after
$ _ SERVER ['document _ root']
# The document root directory where the script is currently running. Defined in the server configuration file.
$ _ SERVER ['http _ ACCEPT ']
# Accept of the current request: content in the header.
$ _ SERVER ['http _ accept_charset']
# Accept-Charset of the current request: content in the header. Example: "ISO-8859-1, *, UTF-8 ".
$ _ SERVER ['http _ ACCEPT_ENCODING ']
# Accept-Encoding of the current request: content in the header. For example, "gzip ".
$ _ SERVER ['http _ ACCEPT_LANGUAGE ']
# Accept-Language of the current request: content in the header. For example, "en ".
$ _ SERVER ['http _ connection']
# Connection of the current request: content in the header. For example, "Keep-Alive ".
$ _ SERVER ['http _ host']
# Host of the current request: content in the header.
$ _ SERVER ['http _ referer']
# URL of the previous page linked to the current page.
$ _ SERVER ['http _ USER_AGENT ']
# User_Agent of the current request: content in the header.
$ _ SERVER ['server _ name']
# Name of the server host where the currently running PHP program is located.
$ _ SERVER ['request _ method']
# The request method used to access the page, namely GET, HEAD, POST, and PUT.
$ _ SERVER ['document _ root']
# The document root directory of the currently running PHP program. That is, the definition in the PHP. ini file.
$ _ SERVER ['http _ referer']
# URL of the previous page linked to the current page. This function is useful in page navigation.
$ _ SERVER ['remote _ ADDR ']
# Browsing the IP address of the visitor on the current page.
$ _ SERVER ['remote _ host']
# The host name of the user browsing the current page.
$ _ SERVER ['remote _ port']
# The port used by the user who is visiting to connect to the server.
$ _ SERVER ['script _ filename']
# The absolute path name of the currently executed script.
$ _ SERVER ['server _ port']
# The port used by the server
$ _ SERVER ['script _ name']
# Contains the path of the current script. This is useful when the page needs to point to itself.
$ _ SERVER ['request _ URI ']
# The URI required to access this page. For example, "/index.html ".
$ _ SERVER ['php _ AUTH_USER ']
# In the HTTP user logon authentication function, this variable is the user name entered by the user.
$ _ SERVER ['php _ AUTH_PW ']
# In the HTTP user logon authentication function, this variable is the password entered by the user.
$ _ SERVER ['auth _ type']
# In the HTTP user logon authentication function, this variable is the authentication type.
$ _ SERVER ['server _ soft']
# The string identified by the server, which is provided in the header of the response request.
System constant
_ FILE _ absolute path and FILE name of the current PHP script
_ LINE _ stores the row number of the constant
_ FUNCTION _ name of the FUNCTION where the constant is stored
_ CLASS _ stores the name of the CLASS where the constant is located.
PHP_VERSION stores the current PHP version, which can also be obtained through the PHPVERSION () function.
PHP_ OS stores the operating system of the current server
Bytes. PHP environment variables include $ GLOBALS [], $ _ SERVER [], and $ _ GE...