zend header already send problem

2019-08-26 02:05发布

问题:

sometimes i got error when i include your class(AuthnetCim.class) in my controller. the error is as below:-

Fatal error: Uncaught exception ‘Zend_Controller_Response_Exception’ with message ‘Cannot send headers; headers already sent in /home/newwebsi/public_html/B4BPHP/public/include/AuthnetCIM.class.php, line 1′ in /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Response/Abstract.php:321 Stack trace: #0 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Response/Abstract.php(148): Zend_Controller_Response_Abstract->canSendHeaders(true) #1 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action/Helper/Redirector.php(226): Zend_Controller_Response_Abstract->setRedirect(‘/B4BPHP/public/…’, 302) #2 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action/Helper/Redirector.php(370): Zend_Controller_Action_Helper_Redirector->_redirect(‘/B4BPHP/public/…’) #3 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action/Helper/Redirector.php(453): Zend_Controller_Action_Helper_Redirector->setGotoUrl(‘index/login’, Array) #4 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action.php(68 in /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Response/Abstract.php on line 321

when i remove this class i do not get any error anywhere

Please, help me to resolve this error

回答1:

Make sure you do not have any characters before <?php in AuthnetCIM.class.php.



回答2:

Ouput is sent to the browser when the file AuthnetCIM.class.php is looked-up/included.

Check for spaces, BOM before the opening PHP tag, echoing/printing statements.

In other words check for anything that might be causing the script to output data.