Magento 错误:标头已发送
在我的网站中将产品添加到购物车时出现此错误:
I got this error while adding products to the cart in my site:
Cannot send headers; headers already sent in /home/website/public_html/app/code/local/Perpetual/MultiAdd/controllers/Checkout/CartController.php, line 153
Trace:
#0 /home/website/public_html/lib/Zend/Controller/Response/Abstract.php(147): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /home/website/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(585): Zend_Controller_Response_Abstract->setRedirect('http://www.trum...')
#2 /home/website/public_html/app/code/core/Mage/Checkout/controllers/CartController.php(85): Mage_Core_Controller_Varien_Action->_redirect('checkout/cart')
#3 /home/website/public_html/app/code/local/Perpetual/MultiAdd/controllers/Checkout/CartController.php(203): Mage_Checkout_CartController->_goBack()
#4 /home/website/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(376): Perpetual_MultiAdd_Checkout_CartController->addmultipleAction()
#5 /home/website/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch('addmultiple')
#6 /home/website/public_html/app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#7 /home/website/public_html/wholesale/index.php(65): Mage::run('wholesale', 'website')
#8 {main}
禁用无关的插件并没有解决问题.
Disabled extraneous plugin and that did not solve issue.
标题似乎在第 1 行发送,并尝试在错误中引用的文件中再次发送,CartController.php
-
It appears that headers are sent in line #1 and attempted to be sent again in the file referenced in the error, CartController.php
-
$url = $this->_getSession()->getRedirectUrl(true)
if ($url) {
$this->getResponse()->setRedirect($url);
} else {
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
}
关于如何阻止 Magento 在 Mage 之前发送标头的任何想法?
Any ideas on how to stop Magento from sending headers before Mage does?
推荐答案
可疑模块被禁用?好吧,那我们去找另一个答案.首先,检查在错误堆栈跟踪之前是否有任何输出.输出会引发为此输出发送标头.
Suspicious module disabled? Ok, let's go for another answer then. First, check whether you get any output before the error stack trace. An output provokes the sending of headers for this output.
相关文章