当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Response_Http::sendResponse方法代码示例

本文整理汇总了PHP中Zend_Controller_Response_Http::sendResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http::sendResponse方法的具体用法?PHP Zend_Controller_Response_Http::sendResponse怎么用?PHP Zend_Controller_Response_Http::sendResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Controller_Response_Http的用法示例。


在下文中一共展示了Zend_Controller_Response_Http::sendResponse方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:13,代码来源:Abstract.php

示例2: sendResponse

 public function sendResponse()
 {
     $gzip = isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false;
     $gzip &= !headers_sent();
     if ($gzip) {
         header('Content-Encoding: gzip');
         ob_start("ob_gzhandler");
     }
     parent::sendResponse();
     if ($gzip) {
         ob_end_flush();
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:13,代码来源:Http.php

示例3: 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

示例4: __construct

 public function __construct($msg = '', $code = 0, Exception $previous = null)
 {
     // just pass ahead if it was throw from the CLI
     if (php_sapi_name() == "cli") {
         return parent::__construct($msg, (int) $code, $previous);
     } else {
         parent::__construct($msg, (int) $code, $previous);
         $response = new Zend_Controller_Response_Http();
         $response->setHttpResponseCode(500);
         ob_get_clean();
         ob_start();
         require APPLICATION_PATH . "/layout/scripts/exception.phtml";
         $outputBuffer = ob_get_clean();
         $response->setBody($outputBuffer);
         $response->sendResponse();
         trigger_error($msg, E_USER_ERROR);
         exit;
     }
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:19,代码来源:Exception.php

示例5: __construct

 public function __construct($app)
 {
     parent::__construct($app);
     date_default_timezone_set('America/Lima');
     $this->bootstrap('multidb');
     /* ejecuta un recurso */
     $db = $this->getPluginResource('multidb')->getDb('db');
     /* obtiene los datos del recurso */
     Zend_Db_Table::setDefaultAdapter($db);
     /* registra el adaptador */
     Zend_Registry::set('db', $db);
     /*registra la clase adaptadora*/
     Zend_Form::setDefaultTranslator(new Zend_Translate('array', APPLICATION_PATH . '/configs/lang/es.php', 'es'));
     $this->getResourceLoader()->addResourceType('entity', 'entitys/', 'Entity');
     $this->getResourceLoader()->addResourceType('service', 'services/', 'Service');
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-Type', 'text/html; charset=utf-8')->setHeader('Accept-Encoding', 'gzip, deflate')->setHeader('Expires', 'max-age=' . 20, true)->setHeader('Cache-Control', 'private', 'must-revalidate')->setHeader('Pragma', 'no-cache', true);
     $response->sendResponse();
 }
开发者ID:nazart,项目名称:kmcomputer,代码行数:19,代码来源:Bootstrap.php

示例6: sendResponse

 /**
  * Used to send the server response to the client.
  */
 public static function sendResponse(Zend_Controller_Response_Http $response)
 {
     // Set the response headers.
     $response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
     // Send the response to the client.
     $response->sendResponse();
 }
开发者ID:mtday,项目名称:timesheet-system,代码行数:10,代码来源:Bootstrap.php

示例7: redirect

 /**
  * Performs a HTTP redirection to specified URL with additional data.
  * It may generate redirected request using GET or POST HTTP method.
  * The function never returns.
  *
  * @param string $url URL to redirect to
  * @param array $params additional variable/value pairs to send
  * @param Zend_Controller_Response_Abstract $response
  * @param string $method redirection method ('GET' or 'POST')
  */
 public static function redirect($url, $params = null, Zend_Controller_Response_Abstract $response = null, $method = 'GET')
 {
     $url = Zend_OpenId::absoluteUrl($url);
     $body = "";
     if (null === $response) {
         #require_once "Zend/Controller/Response/Http.php";
         $response = new Zend_Controller_Response_Http();
     }
     if ($method == 'POST') {
         $body = "<html><body onLoad=\"document.forms[0].submit();\">\n";
         $body .= "<form method=\"POST\" action=\"{$url}\">\n";
         if (is_array($params) && count($params) > 0) {
             foreach ($params as $key => $value) {
                 $body .= '<input type="hidden" name="' . $key . '" value="' . $value . "\">\n";
             }
         }
         $body .= "<input type=\"submit\" value=\"Continue OpenID transaction\">\n";
         $body .= "</form></body></html>\n";
     } else {
         if (is_array($params) && count($params) > 0) {
             if (strpos($url, '?') === false) {
                 $url .= '?' . self::paramsToQuery($params);
             } else {
                 $url .= '&' . self::paramsToQuery($params);
             }
         }
     }
     if (!empty($body)) {
         $response->setBody($body);
     } else {
         if (!$response->canSendHeaders()) {
             $response->setBody("<script language=\"JavaScript\"" . " type=\"text/javascript\">window.location='{$url}';" . "</script>");
         } else {
             $response->setRedirect($url);
         }
     }
     $response->sendResponse();
     if (self::$exitOnRedirect) {
         exit;
     }
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:51,代码来源:OpenId.php

示例8: sendResponse

 public function sendResponse()
 {
     Mage::dispatchEvent('http_response_send_before', array('response' => $this));
     return parent::sendResponse();
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:5,代码来源:Http.php

示例9: sendResponse

 public static function sendResponse(Zend_Controller_Response_Http $response)
 {
     $response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
     $response->sendResponse();
 }
开发者ID:segphault,项目名称:storytlr,代码行数:5,代码来源:Bootstrap.php

示例10: array

$logExtra = array();
$logMessage = false;
try {
    if (!$processor->validateRequest($logMessage)) {
        $logType = 'error';
        $response->setHttpResponseCode(500);
    } else {
        if (!$processor->validatePreConditions($logMessage)) {
            $logType = 'error';
        } else {
            $logType = 'info';
            $logMessage = $processor->processTransaction();
        }
    }
    if (is_array($logMessage)) {
        $temp = $logMessage;
        list($logType, $logMessage) = $temp;
    }
} catch (Exception $e) {
    $response->setHttpResponseCode(500);
    XenForo_Error::logException($e);
    $logType = 'error';
    $logMessage = 'Exception: ' . $e->getMessage();
    $logExtra['_e'] = $e;
}
if ($logType) {
    $processor->log($logType, $logMessage, $logExtra);
}
$response->setBody(htmlspecialchars($logMessage));
$response->sendResponse();
开发者ID:darkearl,项目名称:projectT122015,代码行数:30,代码来源:payment_callback.php

示例11: sendResponse

 public static function sendResponse(Zend_Controller_Response_Http $response)
 {
     $response->sendResponse();
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:4,代码来源:Bootstrap.php

示例12: sendResponse

 /**
  * Send the response, including all headers, rendering exceptions if so
  * requested.
  *
  * @return void
  */
 public function sendResponse()
 {
     $this->sendVary();
     parent::sendResponse();
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:11,代码来源:Http.php

示例13: _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;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:22,代码来源:Bootstrap.php

示例14: sendPackage

 /**
  * @see AM_Handler_Export_Storage_Interface::sendPackage()
  * @throws AM_Handler_Export_Storage_Exception
  */
 public function sendPackage()
 {
     $sFilePath = $this->_buildPackagePath() . DIRECTORY_SEPARATOR . $this->getPackage()->getPackageName();
     $sFileName = $this->getPackage()->getPackageDownloadName();
     if (!file_exists($sFilePath)) {
         throw new AM_Handler_Export_Storage_Exception(sprintf('File "%s" not found', $sFilePath));
     }
     $oResponse = new Zend_Controller_Response_Http();
     $oResponse->setHttpResponseCode(200);
     $oRequest = new Zend_Controller_Request_Http();
     $iFileSize = filesize($sFilePath);
     $sFileMtime = @gmdate("D, d M Y H:i:s", @filemtime($sFilePath)) . " GMT";
     $rFile = @fopen($sFilePath, 'rb');
     $sRange = $oRequest->get('HTTP_RANGE');
     //Trying to resume download according to the HTTP_RANGE header
     if (preg_match('/bytes=(\\d+)-(\\d*)/i', $sRange, $matches)) {
         $sRange = $matches[1];
     } else {
         $sRange = false;
     }
     if ($sRange) {
         fseek($rFile, $sRange);
         $oResponse->setHttpResponseCode(206);
         $oResponse->setHeader('Content-Range', sprintf('bytes %d-%d/%d', $sRange, $iFileSize - 1, $iFileSize));
     }
     $oResponse->setHeader('Content-Disposition', 'attachment; filename=' . $sFileName)->setHeader('Content-Length', $iFileSize - $sRange)->setHeader('Content-Type', 'application/octet-stream')->setHeader('Accept-Ranges', 'bytes')->setHeader('Last-Modified', $sFileMtime);
     while (!feof($rFile)) {
         $sBuffer = fread($rFile, 2048);
         $oResponse->appendBody($sBuffer);
     }
     fclose($rFile);
     $oResponse->sendResponse();
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:37,代码来源:Local.php


注:本文中的Zend_Controller_Response_Http::sendResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。