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


PHP Zend_Controller_Response_Http::setHeader方法代碼示例

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


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

示例1: prepareDiscoveryParams

 public static function prepareDiscoveryParams(array &$params, Zend_Controller_Response_Http $response, $topicType, $topicId, $selfLink, $subscriptionOption)
 {
     if (!bdApi_Option::getSubscription($topicType)) {
         // subscription for this topic type has been disabled
         return false;
     }
     // subscription discovery
     $hubLink = bdApi_Data_Helper_Core::safeBuildApiLink('subscriptions', null, array('hub.topic' => bdApi_Model_Subscription::getTopic($topicType, $topicId), 'oauth_token' => ''));
     $response->setHeader('Link', sprintf('<%s>; rel=hub', $hubLink));
     $response->setHeader('Link', sprintf('<%s>; rel=self', $selfLink));
     // subscription info
     if (!empty($subscriptionOption)) {
         $subscriptionOption = @unserialize($subscriptionOption);
         if (!empty($subscriptionOption['subscriptions'])) {
             /* @var $session bdApi_Session */
             $session = XenForo_Application::getSession();
             $clientId = $session->getOAuthClientId();
             foreach ($subscriptionOption['subscriptions'] as $subscription) {
                 if ($subscription['client_id'] == $clientId) {
                     $params['subscription_callback'] = $subscription['callback'];
                 }
             }
         }
     }
     return true;
 }
開發者ID:billyprice1,項目名稱:bdApi,代碼行數:26,代碼來源:Subscription.php

示例2: send

 /**
  * Send the file to the client (Download)
  *
  * @param  string|array $options Options for the file(s) to send
  * @return void
  */
 public function send($options = null)
 {
     if (is_string($options)) {
         $filepath = $options;
     } else {
         if (is_array($options)) {
             $filepath = $options['filepath'];
         } else {
             throw new Exception("Filename is not set.");
         }
     }
     if (!is_file($filepath) || !is_readable($filepath)) {
         throw new Exception("File '{$filepath}' does not exists.");
     }
     $mimeType = $this->_detectMimeType(array('name' => $filepath));
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-length', filesize($filepath));
     $response->setHeader('Content-Type', $mimeType);
     $response->sendHeaders();
     $handle = fopen($filepath, 'r');
     if ($handle) {
         while (($buffer = fgets($handle, 4096)) !== false) {
             echo $buffer;
         }
         if (!feof($handle)) {
             throw new Exception("Error: unexpected fgets() fail.");
         }
         fclose($handle);
     }
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:36,代碼來源:Http.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param XenForo_Dependencies_Abstract
  * @param Zend_Controller_Response_Http
  * @param Zend_Controller_Request_Http
  */
 public function __construct(XenForo_Dependencies_Abstract $dependencies, Zend_Controller_Response_Http $response, Zend_Controller_Request_Http $request)
 {
     $this->_dependencies = $dependencies;
     $this->_response = $response;
     $this->_request = $request;
     if (!XenForo_Application::isRegistered('config') || XenForo_Application::getConfig()->enableClickjackingProtection) {
         $this->_response->setHeader('X-Frame-Options', 'SAMEORIGIN');
     }
     $this->_preloadContainerData();
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:17,代碼來源:Abstract.php

示例4: _initResponseCharset

 /**
  * Creates a response object, sets the Content-Type header and assigns the
  * response to the front controller.
  *
  * @return null
  */
 protected function _initResponseCharset()
 {
     $front = Zend_Controller_Front::getInstance();
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-Type', 'text/html; charset=utf-8', false);
     $front->setResponse($response);
 }
開發者ID:louiesabado,項目名稱:simple-php-contact-form,代碼行數:13,代碼來源:Bootstrap.php

示例5: _initResponse

 /** Initialise the response and set gzip status
  */
 protected function _initResponse()
 {
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('X-Powered-By', 'Dan\'s magic army of elves')->setHeader('Host', 'finds.org.uk')->setHeader('X-Compression', 'gzip')->setHeader('Accept-Encoding', 'gzip, deflate')->setHeader('Expires', gmdate('D, d M Y H:i:s', time() + 2 * 3600) . ' GMT', true);
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->setResponse($response);
 }
開發者ID:rwebley,項目名稱:Beowulf---PAS,代碼行數:9,代碼來源:Bootstrap.php

示例6: _initFrontControllerOutput

 protected function _initFrontControllerOutput()
 {
     $front = $this->bootstrap('FrontController')->getResource('FrontController');
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
     $front->setResponse($response);
 }
開發者ID:berliozd,項目名稱:cherbouquin,代碼行數:7,代碼來源:Bootstrap.php

示例7: _challengeClient

    /**
     * Challenge Client
     *
     * Sets a 401 or 407 Unauthorized response code, and creates the
     * appropriate Authenticate header(s) to prompt for credentials.
     *
     * @return Zend_Auth_Result Always returns a non-identity Auth result
     */
    protected function _challengeClient()
    {
        if ($this->_imaProxy) {
            $statusCode = 407;
            $headerName = 'Proxy-Authenticate';
        } else {
            $statusCode = 401;
            $headerName = 'WWW-Authenticate';
        }

        $this->_response->setHttpResponseCode($statusCode);

        // Send a challenge in each acceptable authentication scheme
        if (in_array('basic', $this->_acceptSchemes)) {
            $this->_response->setHeader($headerName, $this->_basicHeader());
        }
        if (in_array('digest', $this->_acceptSchemes)) {
            $this->_response->setHeader($headerName, $this->_digestHeader());
        }
        return new Zend_Auth_Result(
            Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID,
            array(),
            array('Invalid or absent credentials; challenging client')
        );
    }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:33,代碼來源:Http.php

示例8: init

 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $sysCache = $registry->get("sysCache");
     $cacheFiles = new Ml_Cache_Files($sysCache);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $frontController = $this->getBootstrap()->getResource('FrontController');
     $dispatcher = $frontController->getDispatcher();
     $request = $frontController->getRequest();
     $router = $frontController->getRouter();
     $router->removeDefaultRoutes();
     $compat = new Zend_Controller_Router_Route_Module(array(), $dispatcher, $request);
     $router->addRoute(HOST_MODULE, $compat);
     $routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
     $router->addConfig($routerConfig, "apiroutes");
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers/helpers');
     $loadOauthStore = Zend_Controller_Action_HelperBroker::getStaticHelper("LoadOauthstore");
     $loadOauthStore->setinstance();
     $loadOauthStore->preloadServer();
     $frontController->setBaseUrl($config['apiroot'])->setParam('noViewRenderer', true)->addModuleDirectory(APPLICATION_PATH . '/modules')->addControllerDirectory(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers');
     $response = new Zend_Controller_Response_Http();
     if (filter_input(INPUT_GET, "responseformat", FILTER_UNSAFE_RAW) == 'json') {
         $contentType = 'application/json';
     } else {
         $contentType = 'text/xml';
     }
     $response->setHeader('Content-Type', $contentType . '; charset=utf-8', true);
     $frontController->setResponse($response);
 }
開發者ID:henvic,項目名稱:MediaLab,代碼行數:30,代碼來源:Api.php

示例9: renderDebugOutput

 /**
  * Renders page-level debugging output and replaces the original view content
  * with it. Alternatively, it could inject itself into the view content.
  *
  * @param string $originalContent Original, rendered view content
  *
  * @return string Replacement rendered view content
  */
 public function renderDebugOutput($originalContent)
 {
     $this->_response->clearHeaders();
     $this->_response->setHttpResponseCode(200);
     $this->_response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
     $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true);
     return XenForo_Debug::getDebugPageWrapperHtml(XenForo_Debug::getDebugHtml());
 }
開發者ID:VoDongMy,項目名稱:xenforo-laravel5.1,代碼行數:16,代碼來源:FrontController.php

示例10: _challengeClient

 /**
  * Challenge Client
  *
  * Sets a 401 Unauthorized response code, and creates the
  * appropriate Authenticate header(s) to prompt for credentials.
  *
  * @return Zend_Auth_Result Always returns a non-identity Auth result
  */
 protected function _challengeClient()
 {
     $this->_response->setHttpResponseCode(401);
     // Send a challenge in each acceptable authentication scheme
     foreach ($this->_schemes as $scheme => $callback) {
         $this->_response->setHeader('WWW-Authenticate', $scheme);
     }
     return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, array(), array('Invalid or absent credentials; challenging client'));
 }
開發者ID:SandeepUmredkar,項目名稱:PortalSMIP,代碼行數:17,代碼來源:M2m.php

示例11: _initResponse

 protected function _initResponse()
 {
     $options = $this->getOptions();
     if (!isset($options['response']['defaultContentType'])) {
         return;
     }
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-Type', $options['response']['defaultContentType'], true);
     $this->bootstrap('FrontController');
     $this->getResource('FrontController')->setResponse($response);
 }
開發者ID:padraic,項目名稱:ZFPlanet,代碼行數:11,代碼來源:Bootstrap.php

示例12: setDownloadFileName

 /**
  * Tells the browser that the data should be downloaded (rather than displayed)
  * using the specified file name.
  *
  * @param string $fileName
  * @param boolean $inline True if the attachment should be shown inline - use with caution!
  */
 public function setDownloadFileName($fileName, $inline = false)
 {
     $type = $inline ? 'inline' : 'attachment';
     $fileName = str_replace('"', '', $fileName);
     if (preg_match('/[\\x80-\\xFF]/', $fileName)) {
         $altNamePart = "; filename*=UTF-8''" . rawurlencode($fileName);
     } else {
         $altNamePart = '';
     }
     $this->_response->setHeader('Content-Disposition', $type . '; filename="' . str_replace('"', '', $fileName) . '"' . $altNamePart, true);
 }
開發者ID:darkearl,項目名稱:projectT122015,代碼行數:18,代碼來源:View.php

示例13: _initResponse

 protected function _initResponse()
 {
     // Ensure front controller instance is present, and fetch it
     $this->bootstrap('FrontController');
     $front = $this->getResource('FrontController');
     /* @var $front Zend_Controller_Front */
     // Initialize and set the response object
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
     $front->setResponse($response);
     return $response;
 }
開發者ID:shevron,項目名稱:zend-simplecal,代碼行數:12,代碼來源:Bootstrap.php

示例14: _challengeClient

 /**
  * Challenge Client
  *
  * Sets a 401 or 407 Unauthorized response code, and creates the
  * appropriate Authenticate header(s) to prompt for credentials.
  *
  * @return Zend_Auth_Result Always returns a non-identity Auth result
  */
 protected function _challengeClient()
 {
     if ($this->_imaProxy) {
         $statusCode = 407;
         $headerName = 'Proxy-Authenticate';
     } else {
         $statusCode = 401;
         $headerName = 'WWW-Authenticate';
     }
     $this->_response->setHttpResponseCode($statusCode);
     $this->_response->setHeader($headerName, $this->_getAuthHeader());
     return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, array(), array('Invalid or absent credentials; challenging client'));
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:21,代碼來源:Abstract.php

示例15: _initModifiedFrontController

 protected function _initModifiedFrontController()
 {
     $options = $this->getOption('resources');
     if (!isset($options['modifiedFrontController']['contentType'])) {
         return;
     }
     $this->bootstrap('FrontController');
     $front = $this->getResource('FrontController');
     //$front->addModuleDirectory(APPLICATION_PATH . '/modules');
     $response = new Zend_Controller_Response_Http();
     $response->setHeader('Content-Type', $options['modifiedFrontController']['contentType'], true);
     $front->setResponse($response);
 }
開發者ID:Tony133,項目名稱:zf-web,代碼行數:13,代碼來源:Bootstrap.php


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