我有一个脚本,调用了header();
,并且自我第一次运行该脚本以来,它已经运行了两天。为什么ob_start()解决了header()错误?
然后几天后,它开始有一个错误,说它不能修改标题信息。
然后我把ob_start();
和ob_end_flush();
谷歌搜索错误,它的工作原理!
错误已经消失,但我的问题是,为什么它在几天前没有ob_start();
和ob_end_flush();
?
我想知道这种行为背后的解释。
顺便说一句,我叫header()
这样:
if(condition is true){
header('Location: anotherpage.php');
}
和我在开始时有一个session_start();
。
你需要在这里粘贴你的代码。 –
检查此:http://php.net/manual/en/function.ob-start.php –
它开始失败,因为你试图在'header();之前输出的东西? – SpacedMonkey