您好,欢迎访问一九零五行业门户网

php Cannot modify header information - headers already sent_PHP教程

本文章介绍了多种关于php cannot modify header information - headers already sent by set 解决方法 ,有需有的朋友可以参考一下。
在 php 配置文件 php.ini 中将 output_buffering 设置为 on。开启即可。
output_buffering = on
-------------------------------
all or nothing, now or never.
有以下几种解决方法:
1. blank lines (空白行):
make sure no blank line after of the calling php script.
检查有 后面没有空白行,特别是include或者require的文件。不少问题是这些空白行导致的。
2. use exit statement (用exit来解决):
 代码如下 复制代码
use exit after header statement seems to help some people
在header后加上exit();
header (location: xxx);
exit();
use javascript (用javascript来解决):
 代码如下 复制代码
echo ; ?>
since it's a script, it won't modify the header until execution of javascript.
可以用javascript来代替header。但是上面的这段代码我没有执行成功... 另外需要注意,采用这种方法需要浏览器支持javascript.
3b. use output buffering (用输出缓存来解决):
 代码如下 复制代码
... html codes ...
http://www.bkjia.com/phpjc/632237.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/632237.htmltecharticle本文章介绍了多种关于php cannot modify header information - headers already sent by set 解决方法 ,有需有的朋友可以参考一下。 在 php 配置文件 php.ini...
其它类似信息

推荐信息