In depth parsing of the server variable $_SERVER

  • 2020-06-23 00:06:14
  • OfStack

In-depth parsing of the server variable $_SERVER:

$_SESSION['PHP_SELF'] -- Gets the file name of the script being executed

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

$_SERVER['REQUEST_TIME'] -- the timestamp at the beginning of the request. Effective from PHP 5.1.0. This is the same as time.

4, $_SERVER['argv'] -- the argument passed to the script. I tried get to get $_SERVER['argv'][0]; The post method cannot assign a value to him.

5, $_SERVER['SERVER_NAME'] -- returns the current host name.

$_SERVER['SERVER_SOFTWARE'] -- string identified by the server, given in the header in response to the request. Such as Microsoft IIS / 6.0

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

$_SERVER['QUERY_STRING'] -- Query (query) string (first question mark in URL? After that).

$_SERVER['DOCUMENT_ROOT'] -- document root where the script is currently running. Defined in the server configuration file. Such as E: \ server

10, $_SERVER['HTTP_ACCEPT'] -- The contents of the current request's Accept: header.

$_SERVER['HTTP_ACCEPT_CHARSET'] -- Current request for ES75en-ES76en: content of header message. For example: "ES77en-8859-1,*, ES78en-8".

$_SERVER['HTTP_ACCEPT_ENCODING'] -- The contents of the current requested ES85en-ES86en: header. For example: "gzip".

13, $_SERVER['HTTP_ACCEPT_LANGUAGE'] -- Current request for ES94en-ES95en: contents of header information. For example: "en".

14, $_SERVER['HTTP_CONNECTION'] -- The contents of the current request's Connection: header. For example: "ES103en-ES104en".

15, $_SERVER['HTTP_HOST'] -- Host: contents of the header for the current request.

$_SERVER['HTTP_REFERER'] -- the URL address that links to the first page of the current page.

17, $_SERVER['HTTP_USER_AGENT'] -- returns the browser information used by the user. You can also get this information using ge
owser().

18, $_SERVER['HTTPS'] -- set to 1 non-null value if accessed through https, otherwise returns off.

$_SERVER['REMOTE_ADDR'] -- The IP address of the user browsing the current page.

$_SERVER['REMOTE_HOST'] -- Hostname of the user browsing the current page. Reverse domain name resolution based on the user's REMOTE_ADDR. For example, the local test returns 127.0.0.1

21, $_SERVER['REMOTE_PORT'] -- the port the user USES to connect to the server. I don't know why I failed the native test.

$_SERVER['SCRIPT_FILENAME'] -- the absolute pathname of the currently executing script. Such as return E: \ server \ index php

23, $_SERVER['SERVER_ADMIN'] -- this value specifies the SERVER_ADMIN parameter in the Apache server configuration file. If the script is running on a virtual host, this value is the value of that virtual host

$_SERVER['SERVER_PORT'] -- the port used by the server. The default is "80". This value is the HTTP port set for the user if the SSL secure connection is used.

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

26, $_SERVER['PATH_TRANSLATED'] -- the base path to the file system (not the document root) where the current script resides. This is the result after the server has mapped the virtual to real path. Apache 2 users can define PATH_INFO using AcceptPathInfo On from ES184en. conf.

$_SERVER['SCRIPT_NAME'] -- contains the path to the current script. This is useful when the page needs to point to itself. ___ contains the absolute path and filename of the current file (for example, contain the file).

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

29, $_SERVER['PHP_AUTH_DIGEST'] -- This variable is set to the "Authorization" HTTP header content sent by the client during HTTP authentication when running as an Apache module (for further authentication).

30, $_SERVER['PHP_AUTH_USER']-- when PHP is running in Apache or IIS (PHP 5 is ISAPI) 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 or IIS (PHP 5 is ISAPI) mode and is using HTTP authentication, this variable is the password entered by the user.

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


Related articles: