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


PHP ResponseHeaderBag::allPreserveCase方法代码示例

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


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

示例1: sendHeaders

 /**
  * Sends HTTP headers.
  *
  * @return Response
  */
 public function sendHeaders()
 {
     // headers have already been sent by the developer
     if (headers_sent()) {
         return $this;
     }
     // status
     header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText));
     // headers
     foreach ($this->headers->allPreserveCase() as $name => $values) {
         foreach ($values as $value) {
             header($name . ': ' . $value, false);
         }
     }
     // cookies
     foreach ($this->headers->getCookies() as $cookie) {
         setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
     }
     return $this;
 }
开发者ID:santiagosisul,项目名称:curso-sf2,代码行数:25,代码来源:Response.php

示例2: testToStringDoesntMessUpHeaders

 public function testToStringDoesntMessUpHeaders()
 {
     $headers = new ResponseHeaderBag();
     $headers->set('Location', 'http://www.symfony.com');
     $headers->set('Content-type', 'text/html');
     (string) $headers;
     $allHeaders = $headers->allPreserveCase();
     $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']);
     $this->assertEquals(array('text/html'), $allHeaders['Content-type']);
 }
开发者ID:hilmysyarif,项目名称:sisfito,代码行数:10,代码来源:ResponseHeaderBagTest.php

示例3: sendHeaders

 /**
  * Sends HTTP headers.
  *
  * @return Response
  */
 public function sendHeaders()
 {
     // headers have already been sent by the developer
     if (headers_sent()) {
         return $this;
     }
     if (!$this->headers->has('Date')) {
         $this->setDate(\DateTime::createFromFormat('U', time()));
     }
     // headers
     foreach ($this->headers->allPreserveCase() as $name => $values) {
         foreach ($values as $value) {
             header($name . ': ' . $value, false, $this->statusCode);
         }
     }
     // status
     header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
     // cookies
     foreach ($this->headers->getCookies() as $cookie) {
         if ($cookie->isRaw()) {
             setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
         } else {
             setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
         }
     }
     return $this;
 }
开发者ID:nsandlin,项目名称:linepig,代码行数:32,代码来源:Response.php

示例4: testAllPreserveCase

    /**
     * @covers Symfony\Component\HttpFoundation\ResponseHeaderBag::allPreserveCase
     * @dataProvider provideAllPreserveCase
     */
    public function testAllPreserveCase($headers, $expected)
    {
        $bag = new ResponseHeaderBag($headers);

        $this->assertEquals($expected, $bag->allPreserveCase(), '->allPreserveCase() gets all input keys in original case');
    }
开发者ID:nysander,项目名称:symfony,代码行数:10,代码来源:ResponseHeaderBagTest.php


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