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


PHP HeaderBag::remove方法代码示例

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


在下文中一共展示了HeaderBag::remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: persistHeaders

 /**
  * Creates an array of cacheable and normalized request headers
  *
  * @param HeaderBag $headers
  * @return array
  */
 private function persistHeaders(HeaderBag $headers)
 {
     // Headers are excluded from the caching (see RFC 2616:13.5.1)
     static $noCache = array('age', 'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade', 'set-cookie', 'set-cookie2');
     foreach ($headers as $key => $value) {
         if (in_array($key, $noCache) || strpos($key, 'x-') === 0) {
             $headers->remove($key);
         }
     }
     // Postman client sends a dynamic token to bypass a Chrome bug
     $headers->remove('postman-token');
     return $headers;
 }
开发者ID:stadline,项目名称:execution-cache-bundle,代码行数:19,代码来源:KeyProvider.php

示例2: setNotModified

 /**
  * Modifies the response so that it conforms to the rules defined for a 304 status code.
  *
  * This sets the status, removes the body, and discards any headers
  * that MUST NOT be included in 304 responses.
  *
  * @see http://tools.ietf.org/html/rfc2616#section-10.3.5
  */
 public function setNotModified()
 {
     $this->setStatusCode(304);
     $this->setContent(null);
     // remove headers that MUST NOT be included with 304 Not Modified responses
     foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) {
         $this->headers->remove($header);
     }
 }
开发者ID:spf13,项目名称:symfony,代码行数:17,代码来源:Response.php

示例3: prepareRequestUri

 protected function prepareRequestUri()
 {
     $requestUri = '';
     if ($this->headers->has('X_ORIGINAL_URL')) {
         // IIS with Microsoft Rewrite Module
         $requestUri = $this->headers->get('X_ORIGINAL_URL');
         $this->headers->remove('X_ORIGINAL_URL');
         $this->server->remove('HTTP_X_ORIGINAL_URL');
         $this->server->remove('UNENCODED_URL');
         $this->server->remove('IIS_WasUrlRewritten');
     } elseif ($this->headers->has('X_REWRITE_URL')) {
         // IIS with ISAPI_Rewrite
         $requestUri = $this->headers->get('X_REWRITE_URL');
         $this->headers->remove('X_REWRITE_URL');
     } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
         // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
         $requestUri = $this->server->get('UNENCODED_URL');
         $this->server->remove('UNENCODED_URL');
         $this->server->remove('IIS_WasUrlRewritten');
     } elseif ($this->server->has('REQUEST_URI')) {
         $requestUri = $this->server->get('REQUEST_URI');
         // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
         $schemeAndHttpHost = $this->getSchemeAndHttpHost();
         if (strpos($requestUri, $schemeAndHttpHost) === 0) {
             $requestUri = substr($requestUri, strlen($schemeAndHttpHost));
         }
     } elseif ($this->server->has('ORIG_PATH_INFO')) {
         // IIS 5.0, PHP as CGI
         $requestUri = $this->server->get('ORIG_PATH_INFO');
         if ('' != $this->server->get('QUERY_STRING')) {
             $requestUri .= '?' . $this->server->get('QUERY_STRING');
         }
         $this->server->remove('ORIG_PATH_INFO');
     }
     // normalize the request URI to ease creating sub-requests from this request
     $this->server->set('REQUEST_URI', $requestUri);
     return $requestUri;
 }
开发者ID:abouthalf,项目名称:archies-recipes,代码行数:38,代码来源:Request.php

示例4: remove

 /**
  * Removes a header.
  *
  * @param string $key
  */
 public function remove($key)
 {
     parent::remove($key);
     $this->updateRequest();
 }
开发者ID:hardwork2015,项目名称:cdp,代码行数:10,代码来源:HeaderBag.php

示例5: remove

 /**
  * {@inheritdoc}
  *
  * @api
  */
 public function remove($key)
 {
     parent::remove($key);
     $uniqueKey = strtr(strtolower($key), '_', '-');
     unset($this->headerNames[$uniqueKey]);
 }
开发者ID:euskadi31,项目名称:spore,代码行数:11,代码来源:HeaderBag.php


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