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


PHP ResponseHeaderBag::remove方法代码示例

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


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

示例1: ensureIEOverSSLCompatibility

 /**
  * Check if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9
  *
  * @link http://support.microsoft.com/kb/323308
  */
 protected function ensureIEOverSSLCompatibility(Request $request)
 {
     if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) {
         if (intval(preg_replace("/(MSIE )(.*?);/", "\$2", $match[0])) < 9) {
             $this->headers->remove('Cache-Control');
         }
     }
 }
开发者ID:santiagosisul,项目名称:curso-sf2,代码行数:13,代码来源:Response.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
  *
  * @api
  */
 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:hykz,项目名称:Depot,代码行数:19,代码来源:Response.php

示例3: testReplaceWithRemove

 public function testReplaceWithRemove()
 {
     $bag = new ResponseHeaderBag(array());
     $this->assertEquals('no-cache', $bag->get('Cache-Control'));
     $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
     $bag->remove('Cache-Control');
     $bag->replace(array());
     $this->assertEquals('no-cache', $bag->get('Cache-Control'));
     $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
 }
开发者ID:joan16v,项目名称:symfony2_test,代码行数:10,代码来源:ResponseHeaderBagTest.php

示例4: testSetCookieHeader

    public function testSetCookieHeader()
    {
        $bag = new ResponseHeaderBag();
        $bag->set('set-cookie', 'foo=bar');
        $this->assertEquals(array(new Cookie('foo', 'bar', 0, '/', null, false, true, true)), $bag->getCookies());

        $bag->set('set-cookie', 'foo2=bar2', false);
        $this->assertEquals(array(
            new Cookie('foo', 'bar', 0, '/', null, false, true, true),
            new Cookie('foo2', 'bar2', 0, '/', null, false, true, true),
        ), $bag->getCookies());

        $bag->remove('set-cookie');
        $this->assertEquals(array(), $bag->getCookies());
    }
开发者ID:symfony,项目名称:symfony,代码行数:15,代码来源:ResponseHeaderBagTest.php


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