The details of $_SERVER in PHP are described

  • 2020-10-31 21:39:30
  • OfStack

$_SERVER['PHP_SELF'] # filename of the script being executed, related to document root.

$_SERVER['argv'] # is the parameter passed to the script.

$_SERVER['argc'] # contains the number of command-line arguments passed to the program (if running in command-line mode).

$_SERVER['GATEWAY_INTERFACE'] # version of the CGI specification used by the server. For example, "CGI/1.1".

$_SERVER['SERVER_NAME'] # name of the server host where the script is currently running.

$_SERVER['SERVER_SOFTWARE'] # server-identified string, given in the header in response to a request.

$_SERVER['SERVER_PROTOCOL'] # the name and version of the communication protocol when requesting the page. For example, "HTTP/1.0".

$_SERVER['REQUEST_METHOD'] # request method when accessing a page. For example: "GET", "HEAD", "POST", "PUT".

$_SERVER['QUERY_STRING'] # query (query) string.

$_SERVER['DOCUMENT_ROOT'] # the document root where the script is currently running. Defined in the server configuration file.

$_SERVER['HTTP_ACCEPT'] # Accept: Contents of the header for the current request.

$_SERVER['HTTP_ACCEPT_CHARSET'] # Current request Accept-ES70en: The contents of the header. For example: "iso-8859-1,*,utf-8".

$_SERVER['HTTP_ACCEPT_ENCODING'] # Current requested ES79en-ES80en: contents of the header. For example: "gzip".

$_SERVER['HTTP_ACCEPT_LANGUAGE']# Es88EN-ES89en: Contents of the header for the current request. For example: "en".

$_SERVER['HTTP_CONNECTION'] # Connection: contents of the header currently requested. For example: "ES97en-ES98en".

$_SERVER['HTTP_HOST'] # Host: Contents of the header for the current request.

$_SERVER['HTTP_REFERER'] # link to the URL address of the first 1 page of the current page.

$_SERVER['HTTP_USER_AGENT'] # User_Agent: Contents of the header for the current request.

$_SERVER['HTTPS'] - set to 1 non-null value (on) if accessed through https, otherwise return off

$_SERVER['REMOTE_ADDR'] # is browsing the IP address of the user on the current page.

$_SERVER['REMOTE_HOST'] # is browsing the hostname of the user on the current page.

$_SERVER['REMOTE_PORT'] # the port used by the user to connect to the server.

$_SERVER['SCRIPT_FILENAME'] # the absolute pathname of the currently executing script.

$_SERVER['SERVER_ADMIN'] # administrator information

$_SERVER['SERVER_PORT'] # port used by the server

$_SERVER['SERVER_SIGNATURE'] # string containing the server version and virtual host name.

$_SERVER['PATH_TRANSLATED'] # the base path of the file system where the current script resides (not the document root directory).

$_SERVER['SCRIPT_NAME'] # contains the path to the current script. This is useful when the page needs to point to itself.

$_SERVER['REQUEST_URI'] # to access the URI required for this page. For example, "/ index. html".

$_SERVER['PHP_AUTH_USER'] # When PHP is running in Apache module mode and is using HTTP authentication, this variable is the username entered by the user.

$_SERVER['PHP_AUTH_PW'] # When PHP is running in Apache module mode and using HTTP authentication, this variable is the password entered by the user.

$_SERVER['AUTH_TYPE'] # When PHP is running in Apache module mode and is using HTTP authentication, this variable is the type of authentication.


Related articles: