The solution of PHP using header jump invalidation

Source: Internet
Author: User
Tags php code

First, the question:

Today header ("Location: $url"), the previous jump can always be, today is not moving, just output results, the past to confirm the check, $url the value of the correct, so in front of the echo $url; The result is an invalid header function.

Second, the solution:

In PHP, use header ("location:test.php") to jump to note the following points:

1, location and ":" No space between the number, or there will be errors.//

2, before using header can not have any output, including included in the page labeled "?>" can not have spaces.

3, after the header of the PHP code will also be executed.

PHP header jump can not have any content output before, because PHP began to execute the browser has sent HTTP header information, and then no longer allow changes.

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, until the header continues to send the content.

Or a simpler way to modify php.ini, find Output_buffering=off modified to output_buffering=4096.

I hope this article will help you with your PHP program design.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.