Magento Debug HEADERS ALREADY SENT错误 [英] Magento Debug HEADERS ALREADY SENT error
问题描述
我在我的system.log文件中收到以下错误:
I am receiving the following error in my system.log file:
2011-01-12T14:16:52+00:00 DEBUG (7): HEADERS ALREADY SENT:
[0] C:\xampp\htdocs\www.mysite.com\app\code\core\Mage\Core\Controller\Response\Http.php:44
[1] C:\xampp\htdocs\www.mysite.com\lib\Zend\Controller\Response\Abstract.php:727
[2] C:\xampp\htdocs\www.mysite.com\app\code\core\Mage\Core\Controller\Response\Http.php:75
[3] C:\xampp\htdocs\www.mysite.com\app\code\core\Mage\Core\Controller\Varien\Front.php:188
[4] C:\xampp\htdocs\www.mysite.com\app\code\core\Mage\Core\Model\App.php:304
[5] C:\xampp\htdocs\www.mysite.com\app\Mage.php:596
[6] C:\xampp\htdocs\www.mysite.com\index.php:81
我知道已经发送的头文件是什么意思,但是我没有想要什么文件导致这个,跟踪并不真的给我任何信息。
I know what "headers already sent" means but I have no idea what file is causing this and the trace doesn't really give me any information.
有没有办法找出违规文件?
Is there a way of finding out the offending file?
谢谢!
推荐答案
这是很难的方法。
查找正在进行日志记录的文件中的位置
Find the location in the file that's doing the logging
C:\xampp\htdocs\www.mysite.com\app\code\core\Mage\Core\Controller\Response\Http.php
Mage::log('HEADERS ALREADY SENT: '.mageDebugBacktrace(true, true, true));
添加日志记录以获取包含/必需的每个文件的副本到目前为止
Add logging to get a copy of every file included/required so far
Mage::log(print_r(get_included_files(),true));
如果您记得将文件恢复为预先混乱,您可以将此日志直接添加到核心文件有条件,或者您可以在
You can add this logging directly to the core file if you remember to restore the file to it's pre messed with condition, or you can add a temporary copy at
app/code/local/Mage/Core/Controller/Response/Http.php
<
as long as you remember to remove it when you're done (or just use git).
查看通常的空白嫌疑犯的这个文件列表,然后检查它们是否有可能产生输出的任何函数( echo
,
print
, readfile
,可能更多)
Check this list of files for the usual white-space suspects, and then check them for any functions that might produce output (echo
, print
, readfile
, there's probably more)
这篇关于Magento Debug HEADERS ALREADY SENT错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!