Warning: Cannot modify header information - headers already sent by
程序员文章站
2022-05-21 13:03:37
...
如果在执行php程序时看到这条警告:"Warning: Cannot modify header information - headers already sent by ....".
有以下几种解决方法:
1. Blank lines (空白行):
,检查 后面没有空白行,特别是include或者require的文件.不少问题是这些空白行导致的。
2. Use exit statement (用exit来解决):在header后加上exit();
header ("Location: xxx");exit();
3.用Javascrīpt来解决:
self.location( file.php );"; ?>
可以用Javascrīpt来代替header。另外需要注意,采用这种方法需要浏览器支持Javascrīpt.
4. 用输出缓存来解决:
永久地址:
转载随意~请带上教程地址吧^^
上一篇: 什么是Trait?php中Trait的申明和使用技巧分享
下一篇: 实例分析一个实用的php验证码类
推荐阅读
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解
-
PHP提示Cannot modify header information - headers already sent by解决方法
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
-
setcookie中Cannot modify header information-headers already_PHP
-
使用ob_flush提示:E_WARNING: Cannot modify header information
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解_php技巧
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解_php技巧
-
Warning Cannot send session cookie - headers already sent.有关问题的解决(PHP的UTF-8 BOM引
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
-
php彻底根绝warning: Cannot add header information - headers already sent in.