Reprinted from: http://blog.csdn.net/amonest/article/details/6432530
PHP's $_server[' Http_referer ' records the address of the previous (jump to this page) anchor tag, which is empty if opened directly in the browser.
Look at the Uchome and Ecshop source code, found often used to $_server[' http_referer '] value. HTTP REFERER is part of the header, and when the browser sends a request to the Web server, it usually takes an HTTP REFERER to tell the server which page link I took from, and the server can get some information for processing. For example, if you link to a friend from my home page, his server will be able to count the number of users who click on the link on my page to visit his website from HTTP Referer. Below you have written an example to illustrate the various changes in Http_referer.
Please save the following code to a php file named referer.php:
Referer1 | Referer2 | Referer3
In the URL field, enter: http://localhost/hellophp/referer.php, execution results are as follows:
[]
Click Connect Refer1 to perform the following results:
[http://localhost/hellophp/referer.php]
Click Connect Refer2 to perform the following results:
[Http://localhost/hellophp/referer.php?p=referer1]
Click Connect Refer3 to perform the following results:
[Http://localhost/hellophp/referer.php?p=referer2]
Click Connect Refer1 to perform the following results:
[Http://localhost/hellophp/referer.php?p=referer3]
In the URL field, enter: Http://localhost/hellophp/referer.php?p=referer2, execution results are as follows:
[]
From the above process we can conclude that the value of $_server[' Http_referer '] is empty when a request is made to the Web server from the URL bar, $_server[' Http_referer ' When a request is made from the link to the Web server The value is the URL where the request was made.