PHP cannot obtain Referer for troubleshooting and referer for troubleshooting
Test results:
<? Phpecho 'test Source: directly load the page <br/> '; echo' <a href = "test_cookie.php"> enter the page </a> <br/> '; echo 'test Source: New window open <br/> '; echo '<a target = "_ blank" href = "test_cookie.php"> go to the page </a> <br/> ';
The code for test_cookie.php is:
<? Phpdate_default_timezone_set ('Asia/Shanghai'); // set the Default Time Zone header ('content-type: text/html; charset = utf8 '); // set the return header information echo date ('Y-m-d H: I: s'); echo "<br/> \ r \ n "; echo 'php obtains Refer: '; $ refer = isset ($ _ SERVER ['HTTP _ referer'])? $ _ SERVER ['HTTP _ referer']: 'No refer found '; echo $ refer; echo "<br/> \ r \ n"; echo: '; echo "<script> document. writeln (document. referrer); </script> "; echo" <br/> \ r \ n ";
I am extremely curious about what causes the first retrieval and the second retrieval.
The environment is LNMPA, the official is http://lnmp.org/lnmpa.html
Use charles to capture packets on Mac
The headers of test1.php are the same for two requests.
The headers of the two request test_cookie.php are consistent.
The problem arises. Why does PHP fail to obtain a refer for two identical requests. Begging for solutions.
More exciting topics focus on five blog http://www.lingdonge.com