SUPEE 6788补丁Magento后无法发送头文件错误

时间:2016-04-26 01:20:09

标签: php json magento

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

在第140行的IndexController.php中,我有这段代码:

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

我认为调用json的方式导致了这个错误。我该如何解决这个问题?

提前致谢。

1 个答案:

答案 0 :(得分:2)

我从上述问题中了解到您希望对数据进行编码并在程序中的某个位置使用它。

如果以上情况属实,那么您可以尝试以下解决方案。

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

由于