本文整理汇总了PHP中Bootstrap::responseSent方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::responseSent方法的具体用法?PHP Bootstrap::responseSent怎么用?PHP Bootstrap::responseSent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::responseSent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorAction
public function errorAction()
{
parent::errorAction();
$this->_helper->output('proto');
$this->view->setClass('Application\\Proto\\AsyncNotification\\Service\\Response');
$this->view->reason = $this->_message;
/*
const OK = 0;
const EXPIRED = 1;
const UNKNOWN_TOKEN = 2;
const WRONG_TOKEN = 3;
const WRONG_PROTO = 4;
const WRONG_MESSAGE = 5;
const UNKNOWN = 10;
*/
// TODO: review exception
$ex = $this->_exception;
switch (true) {
case $ex instanceof Application\Model\Mapper\Exception\MissingCacheException:
$this->view->code = Application\Proto\AsyncNotification\Service\Response\Code::EXPIRED;
break;
case $ex instanceof Application\Model\Mapper\Exception\InvalidArgumentException:
$this->view->code = Application\Proto\AsyncNotification\Service\Response\Code::WRONG_TOKEN;
break;
default:
$this->view->code = Application\Proto\AsyncNotification\Service\Response\Code::UNKNOWN;
break;
}
// TODO Why is sometimes sending response twice??? :S
Bootstrap::$responseSent = true;
}
示例2: errorAction
public function errorAction()
{
parent::errorAction();
$this->view->message = $this->_message;
$this->view->error = $this->_errorCode;
if (!empty($this->_validationEntity)) {
$this->view->entity = $this->_validationEntity;
}
if (!empty($this->_validationErrors)) {
$this->view->validationErrors = $this->_validationErrors;
}
if (!empty($this->_errorMessages)) {
$this->view->errorMessages = $this->_errorMessages;
}
if ($this->_exception instanceof Application\Model\Mapper\Exception\EricssonException) {
$this->view->reason = $this->_exception->getReason();
}
//We need a big body to avoid IE bug about error responses inside iFrame
if ($this->getRequest()->getParam('iframeHack', false)) {
$hash = md5('I hate IE');
$this->_helper->output()->setContentType('text/html');
$this->view->ieHack = str_repeat($hash, 10);
}
// TODO Why is sometimes sending response twice??? :S
Bootstrap::$responseSent = true;
}
示例3: _sendResponse
protected function _sendResponse($httpCode, $code, $message)
{
// TODO Why is sometimes sending response twice??? :S
if (self::$responseSent) {
return;
}
if (!($response = Zend_Controller_Front::getInstance()->getResponse())) {
$response = new Zend_Controller_Response_Http();
}
$response->setHttpResponseCode($httpCode);
if (!$response->getBody()) {
$body = array('code' => $code, 'message' => $message);
$response->setBody(Zend_Json::encode($body));
}
if ($response->canSendHeaders()) {
$response->clearHeaders();
$response->setHeader('Content-Type', 'application/json');
$response->sendResponse();
self::$responseSent = true;
}
exit;
}