$ _ SERVER environment variable usage in php _ PHP Tutorial

Source: Internet
Author: User
Tags http authentication http digest authentication
$ _ SERVER environment variable usage in php. This article introduces the usage of various parameters of $ _ SERVER environment variables. For more information, see this article. $ _ SERVER [PHP_SELF]: relative to the path of the website root directory, This article introduces the usage of various parameters for the $ _ SERVER environment variables. For more information, see this article.


$ _ SERVER ['php _ SELF ']: relative to the path of the website root directory and the PHP program name, it is related to document root.
$ _ SERVER ['http _ referer']: The URL of the previous page linked to the current page.
$ _ SERVER ['script _ name']: the path to the website root directory and the NAME of the PHP program file.
$ _ SERVER ['request _ URI ']: 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 basic PATH of the file system (not the document root directory) where the current PHP program is located.
$ _ SERVER ['query _ string']: query string (the first question mark in the URL? After the content, but does not include # After the content ).
$ _ SERVER ['argv']: the parameter passed to the current PHP program.
$ _ SERVER ['argc ']: number of command line parameters passed to the program in command line mode.
$ _ SERVER ['request _ time']: the timestamp at the start of the REQUEST, effective from PHP 5.1.0.
$ _ SERVER ['request _ method']: The request method used to access the page, for example, "GET", "HEAD", "POST", or "PUT ".
$ _ SERVER ['http _ ACCEPT ']: the Accept of the current request: the content of the header information.
$ _ SERVER ['http _ ACCEPT_CHARSET ']: the Accept-Charset of the current request: the content of the header information. Example: "ISO-8859-1, *, UTF-8 ".
$ _ SERVER ['http _ ACCEPT_ENCODING ']: the Accept-Encoding of the current request: the content of the header information. For example, "gzip ".
$ _ SERVER ['http _ ACCEPT_LANGUAGE ']: the Accept-Language of the current request: the content of the header information. For example, "zh-cn ".
$ _ SERVER ['http _ connection']: the CONNECTION of the current request: the content of the header information. For example, "Keep-Alive ".
$ _ SERVER ['http _ host']: the HOST of the current request: the content of the header information.
$ _ SERVER ['https']: if the PHP program is accessed through the HTTPS protocol, it is set to a non-empty value.
$ _ SERVER ['php _ AUTH_DIGEST ']: During HTTP Digest Authentication when running as an Apache module, this variable is set to the "Authorization" HTTP header content sent by the client (for further authentication ).
$ _ SERVER ['php _ AUTH_USER ']: When PHP runs in the Apache or IIS (PHP 5 is an ISAPI) module and is using the HTTP authentication function, this variable is the user name entered by the user.
$ _ SERVER ['php _ AUTH_PW ']: When PHP runs in the Apache or IIS (PHP 5 is an ISAPI) module and is using the HTTP authentication function, this variable is the password entered by the user.
$ _ SERVER ['auth _ type']: When PHP runs in the Apache module mode and is using the HTTP authentication function, this variable is the authentication TYPE.
Server-related
$ _ SERVER ['document _ root']: ROOT directory of the DOCUMENT where the PHP program is currently running, which is defined in the SERVER configuration file.
$ _ SERVER ['gateway _ interface']: the CGI standard version used by the SERVER, for example, "CGI/1.1 ".
$ _ SERVER ['server _ ADDR ']: IP address of the SERVER on which the PHP program is currently running.
$ _ SERVER ['server _ name']: NAME of the SERVER on which 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 SSL secure connection is used, 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 _ soft']: The string of the SERVER identifier, which is provided in the header of the response request.
$ _ SERVER ['server _ protocol']: name and version of the communication PROTOCOL used to request the page, for example, "HTTP/1.0 ".
Miscellaneous
$ _ SERVER ['http _ USER_AGENT ']: content of the User-Agent: header 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 on the current page is being viewed.
$ _ SERVER ['remote _ host']: HOST name of the user browsing the current page.
$ _ SERVER ['remote _ port']: PORT used by the user to connect to the SERVER

Bytes. $ _ SERVER ['php _ SELF ']: The path relative to the website root directory...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.