Magento 调试头已发送错误 [英] 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:xampphtdocswww.mysite.comappcodecoreMageCoreControllerResponseHttp.php:44
[1] C:xampphtdocswww.mysite.comlibendControllerResponseAbstract.php:727
[2] C:xampphtdocswww.mysite.comappcodecoreMageCoreControllerResponseHttp.php:75
[3] C:xampphtdocswww.mysite.comappcodecoreMageCoreControllerVarienFront.php:188
[4] C:xampphtdocswww.mysite.comappcodecoreMageCoreModelApp.php:304
[5] C:xampphtdocswww.mysite.comappMage.php:596
[6] C:xampphtdocswww.mysite.comindex.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:xampphtdocswww.mysite.comappcodecoreMageCoreControllerResponseHttp.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
只要你记得在完成后删除它(或者只是使用 git).
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 调试头已发送错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!