简体   繁体   English

SUPEE 6788修补程序Magento之后无法发送标题错误

[英]Cannot sent headers error after SUPEE 6788 patch Magento

I'm using a template on my Magento 1.9.1.0 and after patch with SUPEE 6788, I'm getting the following errors in my system.log: 我在Magento 1.9.1.0上使用模板,并在使用SUPEE 6788进行补丁后,在system.log中遇到以下错误:

2016-04-26T00:50:23+00:00 DEBUG (7): Cannot send headers; headers already sent in /usr/share/nginx/html/app/code/community/Ves/Tabs/controllers/IndexController.php, line 140
2016-04-26T00:50:23+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /usr/share/nginx/html/lib/Zend/Controller/Response/Abstract.php:771
[2] /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Response/Http.php:84
[3] /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Varien/Front.php:184
[4] /usr/share/nginx/html/app/code/core/Mage/Core/Model/App.php:354
[5] /usr/share/nginx/html/app/Mage.php:684
[6] /usr/share/nginx/html/index.php:87

In IndexController.php on line 140, I have this code: 在第140行的IndexController.php中,我有以下代码:

echo Mage::helper('core')->jsonEncode( $json );

I think the way as json is called is causing this errors. 我认为json的调用方式会导致此错误。 How can I fix this? 我怎样才能解决这个问题?

Thanks in advance. 提前致谢。

What I understand from above question that you want to encode data and uses it somewhere in your program. 从以上问题中我了解到,您想对数据进行编码并在程序中的某处使用它。

If the above is true then you can try the following solution. 如果以上是正确的,那么您可以尝试以下解决方案。

 $this->getResponse()->clearHeaders()->setHeader('content-type', 'application/json', true); $this->getResponse()->setBody(json_encode($json)); 

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM