PHP obtains information about the superior (origin) URL

1. Get the current domain name:
$_SERVER['SERVER_NAME'];

2. Get the source URL, that is, click to go to the previous page URL of this page
$_SERVER["HTTP_REFERER"];

3. Get the suffix of the current domain name
$_SERVER[' REQUEST_URI'];

4. Get the current domain name
$_SERVER['HTTP_HOST'];

5. Get the physical path of the current file
dirname(__FILE__);

6. Get the upper-level physical path of the current file
dirname(__FILE__)."/.. /";

7. Get the current page address
$_SERVER['PHP_SELF'];

8. This can get the address with parameters
$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?".$_SERVER[" QUERY_STRING"]; 

Guess you like

Origin blog.csdn.net/zy17822307856/article/details/112856736