The PHP tutorial provides multiple methods to obtain URL address bar parameters:
 
$ _ Server ["server_port"] // obtain the port
 
$ _ Server ['HTTP _ host'] // get the domain name or host address
$ _ Server ['server _ name'] // get the domain name or host's PHP: // Input? PHP input stream input description address note: only the main domain name such as xhxu.cn
 
$ _ Server ["request_uri"] // The detailed address after the domain name is obtained, for example,/index. php? Id = 123...
$ _ Server ['php _ Self '] // get the PHP file name
$ _ Server ["QUERY_STRING"] // obtain the URL parameters of PHP.
 
$ _ Server ['HTTP _ referer'] // detailed address of the source webpage
 
Output:
Echo "rewrite:". $ _ Get ["Rewrite"];
Echo "<br> server_port:". $ _ server ["server_port"];
Echo "<br> http_host:". $ _ server ["http_host"];
Echo "<br> SERVER_NAME:". $ _ server ["SERVER_NAME"];
Echo "<br> request_uri:". $ _ server ["request_uri"];
Echo "<br> php_self:". $ _ server ["php_self"];
Echo "<br> QUERY_STRING:". $ _ server ["QUERY_STRING"];
Echo "<br> http_referer:". $ _ server ["http_referer"];
 
Note:
 
Differences between SERVER_NAME and http_host in PHP
 
Enter the following URL in the address bar:
1)Hour
The corresponding value is:
Http_host: www.xhxu.cn
SERVER_NAME: xhxu.cn
 
2)
The corresponding value is:
Http_host: blog.xhxu.cn
SERVER_NAME: xhxu.cn
 
PHP $ _ server attribute description
 
 
 - $ _ Server ['php _ Self '] # File Name of the script being executed, which is related to DocumentRoot. 
- $ _ Server ['argv'] # parameters passed to the script. 
- $ _ Server ['argc '] # contains the number of command line parameters passed to the Program (if running in command line mode ). 
- $ _ Server ['Gateway _ interface'] # The CGI standard version 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 _ soft'] # The string identified by the server, 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 ". 
- $ _ Server ['request _ method'] # Request Method for accessing the page. For example, "get", "head", "Post", and "put ". 
- $ _ Server ['query _ string'] # query string. 
- $ _ Server ['document _ root'] # root directory of the document 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'] # link to the URL of the previous page of the current page. 
- $ _ Server ['HTTP _ user_agent '] # user_agent of the current request: Content in the header. 
- $ _ Server ['https']-If accessed through https, it is set to a non-null value (on); otherwise, off is returned. 
- $ _ Server ['remote _ ADDR '] # the IP address of the user on the current page is being viewed. 
- $ _ Server ['remote _ host'] # The Host Name of the user browsing the current page. 
- $ _ Server ['remote _ port'] # The port used by the user to connect to the server. 
- $ _ Server ['script _ filename'] # the absolute path name of the currently executed script. 
- $ _ Server ['server _ admin'] # administrator Information 
- $ _ Server ['server _ port'] # port used by the server 
- $ _ Server ['server _ signature '] # a string containing the server version and virtual host name. 
- $ _ Server ['path _ translated '] # basic path of the file system where the current script is located (not the root directory of the document. 
- $ _ Server ['script _ name'] # contains the path of the current script. This is useful when the page needs to point to itself. 
- $ _ Server ['request _ URI '] # URI required to access this page. For example, "/index.html ". 
- $ _ Server ['php _ auth_user '] # when PHP runs in the Apache module mode and uses the HTTP authentication function, this variable is the user name entered by the user. 
- $ _ Server ['php _ auth_pw '] # when PHP runs in the Apache module mode 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.