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


PHP ServerRequestFactory::get方法代码示例

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


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

示例1: fromGlobals

 public static function fromGlobals(array $server = null, array $query = null, array $body = null, array $cookies = null, array $files = null)
 {
     $server = parent::normalizeServer($server);
     $files = parent::normalizeFiles($files);
     $headers = parent::marshalHeaders($server);
     return new ServerRequest($server, $files, parent::marshalUriFromServer($server, $headers), parent::get('REQUEST_METHOD', $server, 'GET'), 'php://input', $headers, $cookies, $query, $body, self::marshalProtocolVersion($server));
 }
开发者ID:mkorkmaz,项目名称:selami,代码行数:7,代码来源:ServerRequestFactory.php

示例2: createRequest

 /**
  * Creates a PSR-7 compatible request
  *
  * @param \TYPO3\Flow\Http\Request $nativeRequest Flow request object
  * @param array $files List of uploaded files like in $_FILES
  * @param array $query List of uploaded files like in $_GET
  * @param array $post List of uploaded files like in $_POST
  * @param array $cookies List of uploaded files like in $_COOKIES
  * @param array $server List of uploaded files like in $_SERVER
  * @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object
  */
 protected function createRequest(array $files, array $query, array $post, array $cookies, array $server)
 {
     if (!isset($server['HTTP_HOST'])) {
         $server['HTTP_HOST'] = 'localhost';
     }
     $files = ServerRequestFactory::normalizeFiles($files);
     $server = ServerRequestFactory::normalizeServer($server);
     $headers = ServerRequestFactory::marshalHeaders($server);
     $uri = ServerRequestFactory::marshalUriFromServer($server, $headers);
     $method = ServerRequestFactory::get('REQUEST_METHOD', $server, 'GET');
     return new ServerRequest($server, $files, $uri, $method, 'php://input', $headers, $cookies, $query, $post);
 }
开发者ID:aimeos,项目名称:ai-typo3,代码行数:23,代码来源:Typo3.php

示例3: __construct

 /**
  * Sapi constructor.
  *
  * @param EmitterInterface                $sapiEmitter
  * @param array|null                      $server
  * @param array|null                      $queryParams
  * @param array|object|null               $parsedBody
  * @param array|null                      $cookies
  * @param array|null                      $files
  * @param string|resource|StreamInterface $messageBody
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function __construct(EmitterInterface $sapiEmitter, array $server = null, array $queryParams = null, array $parsedBody = null, array $cookies = null, array $files = null, $messageBody = 'php://input')
 {
     $this->sapiEmitter = $sapiEmitter;
     // returns value if not null or $fallback otherwise
     $get = function ($nullable, $fallback) {
         return $nullable !== null ? $nullable : $fallback;
     };
     // Code below based on ServerRequestFactory::fromGlobals
     $this->server = ServerRequestFactory::normalizeServer($get($server, $_SERVER));
     $this->files = ServerRequestFactory::normalizeFiles($get($files, $_FILES));
     $this->headers = ServerRequestFactory::marshalHeaders($this->server);
     $this->uri = ServerRequestFactory::marshalUriFromServer($this->server, $this->headers);
     $this->method = ServerRequestFactory::get('REQUEST_METHOD', $this->server, 'GET');
     $this->cookies = $get($cookies, $_COOKIE);
     $this->queryParams = $get($queryParams, $_GET);
     $this->parsedBody = $get($parsedBody, $_POST);
     $this->messageBody = $messageBody;
 }
开发者ID:limoncello-php,项目名称:core,代码行数:32,代码来源:Sapi.php

示例4: getServerRequest

 /**
  * {@inheritdoc}
  */
 public function getServerRequest()
 {
     $query = $this->getQuery();
     $post = $this->getPost();
     $cookies = $this->getCookies();
     $server = ServerRequestFactory::normalizeServer($this->params);
     $headers = ServerRequestFactory::marshalHeaders($server);
     $uri = ServerRequestFactory::marshalUriFromServer($server, $headers);
     $method = ServerRequestFactory::get('REQUEST_METHOD', $server, 'GET');
     $request = new ServerRequest($server, [], $uri, $method, $this->stdin, $headers);
     return $request->withCookieParams($cookies)->withQueryParams($query)->withParsedBody($post);
 }
开发者ID:sojimaxi,项目名称:FastCGIDaemon,代码行数:15,代码来源:Request.php


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