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


PHP ServerBag::getHeaders方法代码示例

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


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

示例1: getHeaders

 /**
  * information about case sensitivity:
  * @link http://stackoverflow.com/questions/7718476/are-http-headers-content-type-c-case-sensitive
  * @return array
  */
 private function getHeaders()
 {
     $headers = [];
     foreach ($this->serverBag->getHeaders() as $key => $value) {
         $key = str_replace(' ', '-', str_replace('_', ' ', $key));
         $headers[] = '-H \'' . $key . ': ' . $value . '\'';
     }
     return $headers;
 }
开发者ID:yapro,项目名称:debug,代码行数:14,代码来源:RequestAsCurl.php

示例2: initialize

 /**
  * Sets the parameters for this request.
  *
  * This method also re-initializes all properties.
  *
  * @param array  $query      The GET parameters
  * @param array  $request    The POST parameters
  * @param array  $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
  * @param array  $cookies    The COOKIE parameters
  * @param array  $files      The FILES parameters
  * @param array  $server     The SERVER parameters
  * @param string $content    The raw body data
  *
  * @api
  */
 public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
 {
     $this->request = new ParameterBag($request);
     $this->query = new ParameterBag($query);
     $this->attributes = new ParameterBag($attributes);
     $this->cookies = new ParameterBag($cookies);
     $this->files = new FileBag($files);
     $this->server = new ServerBag($server);
     $this->headers = new HeaderBag($this->server->getHeaders());
     $this->content = $content;
     $this->languages = null;
     $this->charsets = null;
     $this->acceptableContentTypes = null;
     $this->pathInfo = null;
     $this->requestUri = null;
     $this->baseUrl = null;
     $this->basePath = null;
     $this->method = null;
     $this->format = null;
 }
开发者ID:mesushan,项目名称:FirstRepo,代码行数:35,代码来源:Request.php

示例3: testHttpPasswordIsOptional

 public function testHttpPasswordIsOptional()
 {
     $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo'));
     $this->assertEquals(array('AUTHORIZATION' => 'Basic ' . base64_encode('foo:')), $bag->getHeaders());
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:5,代码来源:ServerBagTest.php

示例4: testOAuthBearerAuth

 public function testOAuthBearerAuth()
 {
     $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
     $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent));
     $this->assertEquals(array('AUTHORIZATION' => $headerContent), $bag->getHeaders());
 }
开发者ID:Rudi9719,项目名称:stein-syn,代码行数:6,代码来源:ServerBagTest.php

示例5: testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet

 /**
  * @see https://github.com/symfony/symfony/issues/17345
  */
 public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet()
 {
     $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
     $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent));
     $this->assertEquals(array('AUTHORIZATION' => $headerContent, 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => ''), $bag->getHeaders());
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:9,代码来源:ServerBagTest.php

示例6: testHttpBasicAuthWithPhpCgiEmptyPassword

    public function testHttpBasicAuthWithPhpCgiEmptyPassword()
    {
        $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:')));

        $this->assertEquals(array(
            'AUTHORIZATION' => 'Basic '.base64_encode('foo:'),
            'PHP_AUTH_USER' => 'foo',
            'PHP_AUTH_PW' => ''
        ), $bag->getHeaders());
    }
开发者ID:redpanda,项目名称:symfony,代码行数:10,代码来源:ServerBagTest.php

示例7: testShouldExtractHeadersFromServerArray

 public function testShouldExtractHeadersFromServerArray()
 {
     $server = array('SOME_SERVER_VARIABLE' => 'value', 'SOME_SERVER_VARIABLE2' => 'value', 'ROOT' => 'value', 'HTTP_CONTENT_TYPE' => 'text/html', 'HTTP_CONTENT_LENGTH' => '0', 'HTTP_ETAG' => 'asdf');
     $bag = new ServerBag($server);
     $this->assertEquals(array('CONTENT_TYPE' => 'text/html', 'CONTENT_LENGTH' => '0', 'ETAG' => 'asdf'), $bag->getHeaders());
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:6,代码来源:ServerBagTest.php


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