本文整理汇总了PHP中Zend_Controller_Response_Http::clearAllHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http::clearAllHeaders方法的具体用法?PHP Zend_Controller_Response_Http::clearAllHeaders怎么用?PHP Zend_Controller_Response_Http::clearAllHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Response_Http
的用法示例。
在下文中一共展示了Zend_Controller_Response_Http::clearAllHeaders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _error
protected function _error($message = null, $statusCode = self::REST_STATUS_BAD_REQUEST)
{
if (is_numeric($statusCode)) {
$statusCode = intval($statusCode);
}
$this->_response->clearAllHeaders()->clearBody();
$this->_response->setHttpResponseCode(intval($statusCode))->setHeader('Content-Type', 'application/json', true);
if (!empty($message)) {
$this->_response->setBody(json_encode($message));
}
$this->_response->sendResponse();
exit;
}
示例2: run
public function run(Zend_Controller_Response_Abstract $response = null)
{
$args = array($this);
$this->runCallback(self::CB_BEFORE_RUN, $args);
if ($response === null) {
$response = new Zend_Controller_Response_Http();
}
$this->response = $response;
$action = $this->getCurrentAction();
$this->request->setActionName($action);
ob_start();
$this->actionRun($action);
if ($this->response->isRedirect() && $this->completeRequest->isXmlHttpRequest()) {
$url = null;
foreach ($response->getHeaders() as $header) {
if ($header['name'] == 'Location') {
$url = $header['value'];
}
}
$code = $response->getHttpResponseCode();
// change request to ajax response
$response->clearAllHeaders();
$response->clearBody();
$response->setHttpResponseCode(200);
$response->setHeader("Content-Type", "application/json; charset=UTF-8", true);
$response->setBody(Am_Controller::getJson(array('ngrid-redirect' => $url, 'status' => $code)));
//throw new Am_Exception_Redirect($url);
} else {
$response->appendBody(ob_get_clean());
}
unset($this->response);
return $response;
}
示例3: clearAllHeaders
/**
* Clear all headers, normal and raw
*
* @return Zym_Controller_Response_Http
*/
public function clearAllHeaders()
{
// Clear cookies
$this->clearCookies();
return parent::clearAllHeaders();
}