當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Controller_Response_Http::clearBody方法代碼示例

本文整理匯總了PHP中Zend_Controller_Response_Http::clearBody方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Controller_Response_Http::clearBody方法的具體用法?PHP Zend_Controller_Response_Http::clearBody怎麽用?PHP Zend_Controller_Response_Http::clearBody使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Controller_Response_Http的用法示例。


在下文中一共展示了Zend_Controller_Response_Http::clearBody方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendResponse

 /**
  * Send response to browser with json content type
  */
 public function sendResponse()
 {
     $this->_response = Mage::app()->getResponse();
     //check redirect
     if ($this->_response->isRedirect()) {
         $headers = $this->_response->getHeaders();
         $redirect = '';
         foreach ($headers as $header) {
             if ("Location" == $header["name"]) {
                 $redirect = $header["value"];
                 break;
             }
         }
         if ($redirect) {
             $this->setRedirect($redirect);
         }
     }
     $this->_response->clearHeaders();
     $this->_response->setHeader('Content-Type', 'application/json');
     $this->_response->clearBody();
     $this->_response->setBody($this->toJson());
     $this->_response->sendResponse();
     exit;
 }
開發者ID:doctea,項目名稱:VF_EasyAjax,代碼行數:27,代碼來源:Response.php

示例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;
 }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:33,代碼來源:ReadOnly.php

示例3: clearBody

 /**
  * reset body output values
  *
  * @param null|string $name
  *
  * @return void
  */
 public function clearBody($name = null)
 {
     $this->outputBodyCallback = null;
     return parent::clearBody($name);
 }
開發者ID:rukzuk,項目名稱:rukzuk,代碼行數:12,代碼來源:Http.php


注:本文中的Zend_Controller_Response_Http::clearBody方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。