Home  >  Article  >  Backend Development  >  PHP header cannot find path

PHP header cannot find path

尚
Original
2019-10-31 14:30:342369browse

PHP header cannot find path

When using header("location:test.php") to jump in PHP, please pay attention to the following points:

1. Between location and ":" There must be no spaces, otherwise an error will occur. //phpfensi.com

2. There must be no output before using the header, including no spaces after the tag "?>" in the include page.

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

No content can be output before the PHP header jumps, because PHP has already sent HTTP header information to the browser when it starts executing. Changes are no longer allowed.

But if you must process the header information after output, you can use ob_start() ob_end_flush() to cache the content to be sent, and wait until the header continues to send the content.

Or a simpler way, modify php.ini, find output_buffering=Off and change it to output_buffering=4096.

Recommended: php server

The above is the detailed content of PHP header cannot find path. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn