Home >Backend Development >PHP Tutorial >PHP global variables and super global variable sharing
There are many superglobal variables in php, which means that they are available in the entire scope of a script. They can be accessed within a function or method without executing global $variable;.
These super global variables are:
Description | |
---|---|
Returns the file name of the currently executing script. | |
Returns the version of the CGI specification used by the server. | |
Returns the IP address of the server where the script is currently running. | |
Returns the host name of the server where the script is currently running (such as www.w3school.com.cn). | |
Returns the server identification string (such as Apache/2.2.24). | |
Returns the name and version of the communication protocol when the page was requested (for example, "HTTP/1.0"). | |
Returns the request method used to access the page (such as POST). | |
Returns the timestamp when the request started (for example, 1577687494). | |
Returns the query string, if this page is accessed through the query string. | |
Returns the request headers from the current request. | |
Return the Accept_Charset header from the current request (such as utf-8, ISO-8859-1) | |
Return the Host header from the current request. | |
Returns the full URL of the current page (not reliable as not supported by all user agents). | |
Whether to query the script through the secure HTTP protocol. | |
Returns the IP address of the user browsing the current page. | |
Returns the host name of the user browsing the current page. | |
Returns the port number used to connect to the web server on the user's machine. | |
Returns the absolute path of the currently executing script. | |
This value specifies the SERVER_ADMIN parameter in the Apache server configuration file. | |
The port used by the Web server. The default value is "80". | |
Returns the server version and virtual host name. | |
The base path of the file system (not the document root directory) where the current script is located. | |
Returns the path of the current script. | |
Returns the URI of the current page. |
The above is the detailed content of PHP global variables and super global variable sharing. For more information, please follow other related articles on the PHP Chinese website!