Warning: Cannot modify header information - headers already sent by
发布:smiling 来源: PHP粉丝网 添加日期:2013-12-04 22:26:32 浏览: 评论:0
如果在执行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. 用输出缓存来解决:
- ... HTML codes ...
- ... PHP codes ...
- header ("Location: ....");
- ob_end_flush();
- ?>
Tags: Warning Cannot modifyCannot modify
相关文章
- ·Warning: mysql_fetch_array():(2013-11-28)
- ·Warning: Missing argument 3 for photo_bigclass()(2013-11-28)
- ·Warning: mssql_connect() [function.mssql-connect]:(2013-11-28)
- ·Warning: mysql_fetch_assoc() expects parameter 1 to be resource(2013-12-02)
- ·php 提示Warning: mysql_fetch_array() expects(2014-01-09)
- ·Warning: mysql_num_rows():(2014-01-14)
- ·Warning:chmod() has been disabled for security reasons in(2014-08-23)
- ·php提示 Warning: touch() [function.touch]: Utime failed: Permission denied in(2014-09-20)
- ·php提示Warning: file_get_contents(): couldn’t resolve(2014-09-20)
- ·PHP Warning:phpinfo() has been disabled函数禁用(2014-09-21)
- ·php 提示Warning: mysql_fetch_array() expects(2014-09-21)
- ·php下foreach()错误提示Warning: Invalid argument supplied for foreach()(2014-09-22)
- ·phpmyamdin安装出现Warning: require(./libraries/Error_Handler.class.php) 错(2015-04-04)
- ·PHP Warning: implode() [function.implode]: Invalid(2015-04-08)
- ·PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法(2020-11-25)
- ·PHP错误Warning: Cannot modify header information - headers already sent by解决方法(2021-04-14)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)