Magento Debug HEADERS ALREADY SENT 错误 [英] Magento Debug HEADERS ALREADY SENT error

查看:13
本文介绍了Magento Debug HEADERS ALREADY SENT 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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).

检查此文件列表中是否存在常见的空白嫌疑人,然后检查它们是否有任何可能产生输出的函数(echoprintreadfile,可能还有更多)

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆