PHP using the header jump invalidation solution, Phpheader jump failure _php Tutorial

Source: Internet
Author: User

PHP using header Jump failure resolution, Phpheader jump failure


The example of this article describes the PHP use header jump failure solution, share for everyone for reference. The specific methods are analyzed as follows:

First, the question:

Today header (\ "Location: $url \"), the past jump always can, but today does not move, just the output, the past to confirm the check, $url the value is correct, so in the front with the Echo $url; The result is an invalid header function.

Second, the solution:

In PHP with the header ("location:test.php") to jump to pay attention to the following points:

1, location and ":" No space between, otherwise it will be wrong.//phpfensi.com

2, before using the header can not have any output, including the page of the include label "?>" cannot have a space.

3. The PHP code after the header will also be executed.

The header of PHP cannot have any content output before it jumps because PHP has sent the HTTP header information to the browser when it starts executing, and then it is no longer allowed to change.

However, if you have to process header information after the output, you can use Ob_start () Ob_end_flush () to cache the content you want to send, and wait until the header continues to send the content.

Or an easier way to modify php.ini, to find Output_buffering=off modified to output_buffering=4096.

I hope this article is helpful to everyone's PHP programming.


PHP header () page jump problem

If you're sure you want to post it, that's a very complicated thing, because PHP is required to simulate the post submission, you can use Fsockopen to handle it, and I can teach you the specific plan.
Another way is to use the get scheme, relatively speaking, is a super-simple, direct steering, the post data into a Get mode header past.
Another solution is to use Ajax in the previous paragraph to handle it. On the A page Ajax submits the data to b.php, according to the return value of the non-pass verification, and then the page with JS to b.php, if the return value on behalf of the verification passed, again the current post data submitted again to c.php.

PHP header can not jump, on the local machine is not a problem, but uploaded to the server there is a problem, jump, do not want to refresh to jump to the specified page

Coding problem Change Charset=utf-8 to charset=gb2312

http://www.bkjia.com/PHPjc/899065.html www.bkjia.com true http://www.bkjia.com/PHPjc/899065.html techarticle PHP using header Jump Failure resolution method, Phpheader jump Failure This example tells the PHP use header jump failure solution, share to everyone for your reference. Concrete Method Analysis ...

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