PHP cannot obtain Referer for troubleshooting

Source: Internet
Author: User
: This article mainly introduces how to troubleshoot the problem that PHP cannot obtain Referer. if you are interested in the PHP Tutorial, refer to it. Test results:

The same page is opened twice. the Referer cannot be obtained twice for the first time. I'm curious about the reason.

The test1.php code is:

 '; Echo' to go to the page
'; Echo' Test Source: New window opens
'; Echo' to go to the page
';

The code for test_cookie.php is:

 \ R \ n "; echo 'php gets Refer: '; $ refer = isset ($ _ SERVER ['http _ referer'])? $ _ SERVER ['http _ referer']: 'No refer found '; echo $ refer; echo"
\ R \ n "; echo 'JS get Refer: '; echo" script document. writeln (document. referrer); script "; echo"
\ 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

The above describes how to troubleshoot the problem that PHP cannot obtain Referer, including related content, and hope to help those who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.