Home > Article > Backend Development > 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!