Use the PHP program header location to carry out a jump to the attention of a detail

Source: Internet
Author: User
Tags php website
Use the PHP program header location to jump to the attention of a detail!

As we all know, PHP website jumps three ways: JS, HTML META Refresh, PHP header ("Location: $url"). But here is a very small detail that can easily lead to errors.

Once made a jump program, the results ignored this point, resulting in the jump is actually not successful.


Program all source code as follows, program address: http://www.35dalu.com/go.php

 
When the access address is: Http://www.35dalu.com/go.php?url=http%3A%2F%2Fwww.zbphp.com%2F, the Firefox browser is normal. Later this jump program copied to the company's other website, so that some friends on the QQ test, the result many people say that cannot open: IE kernel browser direct prompt cannot access or find, chrome sometimes prompts to be reset or cannot find, use the Firefox test also even occasionally hint can't find, But it only shows up once more.


Check the code carefully, there is no problem. In addition, Firefox can jump, after thinking of the past to read the point is:IE browser if the output of the content byte is too small (less than 512 bytes), then it will be ignored . Then the source code from the header location to change to JS HTML to all browsers are tested through, the original even appeared in Firefox click Prompt can not find the XXX server did not appear again, now go.php all source code:

 
   
 
   
 
   
 
   '; exit ();} $url = UrlDecode (Trim ($_request[' url ")), if ($url) {    gheader ($url);} else {    exit (' Error input,go back ');}

For PHP jump, I think the best way is to use js+html META. HTML Meta ensures that visitors can jump to the same situation if JS is disabled .

If you have a better way, welcome to reply or send an email to me, my mailbox admin@zbphp.com.


  • 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.