解决Warning: Cannot modify header information - headers already sent by....

Posted 伴老思源

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决Warning: Cannot modify header information - headers already sent by....相关的知识,希望对你有一定的参考价值。

【详细错误】:Warning: Cannot modify header information - headers already sent by (output started at ……\\ICNet\\smarty\\Smarty.class.php:358) in ……\\ICNet\\class\\public.function.php on line 35

【排查经过】:根据提示进入public.function.php发现是setcookie()创建本地Cookie时出现的警告. 

【解决办法】:

1. 打开php.ini中的output_buffering:output_buffering = 4096
2. 如果setcookie之前存在在header()语句,那么在header()之前打开缓冲器:ob_start();

【注意】:setcookie函数必須在任何資料輸出至浏览器前先调用~

以上是关于解决Warning: Cannot modify header information - headers already sent by....的主要内容,如果未能解决你的问题,请参考以下文章

PHP错误Warning: Cannot modify header information - headers already sent by解决方法

wordpress后台Warning: Cannot modify header information - headers already sent by

Warning: Cannot modify header information - headers already sent in Unknown on line 0

php5.6,Ajax报错,Warning: Cannot modify header information - headers already sent in Unknown on line 0(

Cannot modify header information - headers already sent by (output started at /data/home/

Gtk-WARNING **: cannot open display: :0.0之解决