当我们将AuthnetCIM.class.php类包含到控制器中时,我们有时会遇到错误。代码如下:
<?php
require_once 'include/AuthnetCIM.class.php';
include(CAPTCHA_ROOT.'recaptchalib.php');
// get a key at http://www.google.com/recaptcha/mailhide/apikey
$mailhide_pubkey = '6LfP_cESAAAAAKtGvePIIra7rB7sVAa6gd6nBaVO';
$mailhide_privkey = '6LfP_cESAAAAAIFyf6u3y2rQv0_B4zNA9VJLQei2';
class BrokerController extends AppController
{
public function init()
{
/* Initialize action controller here */
}
}
?>
我在打开和关闭php标签之前和之后都没有任何空格。
在initAction()之后我有一个使用AuthnetCIM.class.php类的动作。
错误如下:
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