Here I want to summarize some information about the path where the URL and file in the address bar belong: Application $ _ SERVER [] we can do a lot of things: it is an array containing headers, path information, and script status.
Here I want to summarize some information about the path where the URL and file in the address bar belong to me:
The application $ _ SERVER [] can accomplish many things: it is an array containing headers, path information, and script status. the array entity is created by the web SERVER.
This is a "superglobal", or it can be described as an active global variable. This only means that it is valid in all scripts. You do not need to apply global $ _ SERVER; to access a function or method, just like applying $ HTTP_SERVER_VARS. $ HTTP_SERVER_VARS contains the same information, but it is not an active global variable. (Note: $ HTTP_SERVER_VARS and $ _ SERVER are different variables. PHP processes them differently .) If the register_globals command is set, these variables are also available in all scripts; that is, the $ _ SERVER and $ HTTP_SERVER_VARS arrays are respectively set.
$ _ SERVER ['http _ host'] obtains the requested HOST: header content
$ _ SERVER ['php _ SELF '], which is probably the most frequently used one. it returns the name of the currently called page, for example, http: // localhost/test/2005/test. php,/test/2005/test will be returned. php
$ _ SERVER ['script _ name'] returns the path containing the current SCRIPT. This is useful when the page needs to point to itself.
$ _ SERVER ['script _ filename'], which returns the path of the current file.
$ _ SERVER ['request _ URI '] returns the URI required to visit this page, including '/'
Of course there are many path functions:
Dirname (), returns the directory section in the path information, with '/' in front
Basename () returns the basic file name part in the path. you can also set a suffix to hold the output.
Realpath (): returns the normalized path of the path information.