ob_start()和ob_end_flush()的PHP头问题
发布时间:2020-12-13 13:50:24 所属栏目:PHP教程 来源:网络整理
导读:当我在页面的开头使用ob_start()而在结尾使用ob_end_flush()时,我遇到了头问题.因为我在一些查询执行后使用头函数. ob_start(); include_once("header.php"); global $db; $countstmt="SELECT COUNT(*) FROM tbl_lib_hours dh WHERE book_id IN(SELECT book_
当我在页面的开头使用ob_start()而在结尾使用ob_end_flush()时,我遇到了头问题.因为我在一些查询执行后使用头函数.
ob_start(); include_once("header.php"); global $db; $countstmt="SELECT COUNT(*) FROM tbl_lib_hours dh WHERE book_id IN(SELECT book_id FROM tbl_book WHERE user_id=".$_SESSION['uid'].") "; $delHourExist=$db->query($countstmt); if($delHourExist){ header("location:edit_delivery_hours.php"); } .... include_once('footer.php'); ob_end_flush(); 在header.php中我还添加了ob_start();在footer.php中我添加了ob_end_flush();,但我认为这不是问题,虽然其他页面使用我在上面写的相同脚本运行 我得到的错误:
我有点困惑,警告消息不包括导致第一个内容被发送到客户端的代码的位置.功能
headers_sent()也可以返回该位置.因此,出于调试目的,请尝试
if($delHourExist) { if ( headers_sent($path,$lineno) ) { echo '<pre>Debug: output started at ',$path,':',$lineno,"</pre>n"; } header("location: edit_delivery_hours.php"); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |