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


PHP UriInterface::getQuery方法代码示例

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


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

示例1: getRequestTarget

 public function getRequestTarget()
 {
     if ($this->requestTarget !== null) {
         return $this->requestTarget;
     }
     $target = $this->uri->getPath();
     if ($target == null) {
         $target = '/';
     }
     if ($this->uri->getQuery()) {
         $target .= '?' . $this->uri->getQuery();
     }
     return $target;
 }
开发者ID:cdyweb,项目名称:http-adapter,代码行数:14,代码来源:Request.php

示例2: getRequestTarget

 /**
  * Retrieves the message's request target.
  *
  * Retrieves the message's request-target either as it will appear (for
  * clients), as it appeared at request (for servers), or as it was
  * specified for the instance (see withRequestTarget()).
  *
  * In most cases, this will be the origin-form of the composed URI,
  * unless a value was provided to the concrete implementation (see
  * withRequestTarget() below).
  *
  * If no URI is available, and no request-target has been specifically
  * provided, this method will return the string "/".
  *
  * @return string
  */
 public function getRequestTarget()
 {
     // Use the explicitly set request target first.
     if (isset($this->requestTarget)) {
         return $this->requestTarget;
     }
     // Build the origin form from the composed URI.
     $target = $this->uri->getPath();
     $query = $this->uri->getQuery();
     if ($query) {
         $target .= "?" . $query;
     }
     // Return "/" if the origin form is empty.
     return $target ?: "/";
 }
开发者ID:pjdietz,项目名称:wellrested,代码行数:31,代码来源:Request.php

示例3: targetFromUri

 /**
  * Gets the request target from current URI
  *
  * @return string
  */
 private function targetFromUri()
 {
     $target = $this->uri->getPath();
     $target .= '' === $this->uri->getQuery() ? '' : '?' . $this->uri->getQuery();
     $target = empty($target) ? '/' : $target;
     return $target;
 }
开发者ID:slickframework,项目名称:http,代码行数:12,代码来源:Request.php

示例4: handle

 /**
  * @param AccessToken $accessToken
  * @param UriInterface $destination
  * @return Response
  */
 public function handle(AccessToken $accessToken, UriInterface $destination)
 {
     $claims = $this->userService->getUserClaims($accessToken)->toArray();
     $jwt = $this->encoderService->encode($claims);
     $q = $destination->getQuery();
     $q .= ($q ? '&' : '') . 'jwt=' . $jwt;
     return new RedirectResponse((string) $destination->withQuery($q));
 }
开发者ID:cultuurnet,项目名称:jwt-provider,代码行数:13,代码来源:JwtOAuthCallbackHandler.php

示例5: getRequestTarget

 /**
  * @return string
  */
 public function getRequestTarget()
 {
     if (isset($this->requestTarget) && $this->requestTarget !== '') {
         return $this->requestTarget;
     }
     if (!isset($this->uri)) {
         return '/';
     }
     $target = $this->uri->getPath();
     if ($this->uri->getQuery() !== '') {
         $target .= '?' . $this->uri->getQuery();
     }
     if ($target === '') {
         $target = '/';
     }
     return $target;
 }
开发者ID:Golpha,项目名称:Http,代码行数:20,代码来源:RequestTrait.php

示例6: getRequestTarget

 /**
  * @inheritdoc
  */
 public function getRequestTarget()
 {
     if ($this->requestTarget !== null) {
         return $this->requestTarget;
     }
     $this->requireUri();
     if ($this->uri === null) {
         return '/';
     }
     $target = $this->uri->getPath();
     $query = $this->uri->getQuery();
     if ($query !== '') {
         $target .= '?' . $query;
     }
     $this->requestTarget = $target;
     return $this->requestTarget;
 }
开发者ID:phpixie,项目名称:http,代码行数:20,代码来源:Request.php

示例7: getRequestTarget

 /**
  * {@inheritdoc}
  */
 public function getRequestTarget()
 {
     if ($this->requestTarget !== null) {
         return $this->requestTarget;
     }
     if (!$this->uri instanceof UriInterface) {
         return '/';
     }
     $this->requestTarget = $this->uri->getPath();
     if (!$this->requestTarget) {
         $this->requestTarget = '/';
     }
     if ($this->uri->getQuery()) {
         $this->requestTarget .= '?' . $this->uri->getQuery();
     }
     return $this->requestTarget;
 }
开发者ID:radphp,项目名称:network,代码行数:20,代码来源:Request.php

示例8: createRtmpUrl

 private function createRtmpUrl(UriInterface $uri)
 {
     // Use a relative URL when creating Flash player URLs
     $result = ltrim($uri->getPath(), '/');
     if ($query = $uri->getQuery()) {
         $result .= '?' . $query;
     }
     return $result;
 }
开发者ID:AWSRandall,项目名称:aws-sdk-php,代码行数:9,代码来源:UrlSigner.php

示例9: addQueryParameters

 /**
  * Merges additional query parameters with current query parameters (possibly overwriting (some of) them)
  *
  * @param UriInterface $uri
  * @param array $queryParameters Query parameters to add / overwrite
  * @return UriInterface
  */
 public static function addQueryParameters(UriInterface $uri, array $queryParameters)
 {
     $originalQuery = $uri->getQuery();
     $originalQueryParameters = [];
     parse_str($originalQuery, $originalQueryParameters);
     $newQueryParameters = array_replace_recursive($originalQueryParameters, $queryParameters);
     $newQuery = http_build_query($newQueryParameters);
     $newUri = $uri->withQuery($newQuery);
     return $newUri;
 }
开发者ID:subscribo,项目名称:psr-http-message-tools,代码行数:17,代码来源:UriFactory.php

示例10: getQueryParams

 /**
  * Gets the query parameters as an array from a ``UriInterface`` instance.
  *
  * @param UriInterface $uri
  * @param array $exclude
  * @param array $params
  *
  * @return array
  */
 public function getQueryParams(UriInterface $uri, $exclude = ['sig'], $params = [])
 {
     parse_str($uri->getQuery(), $params);
     foreach ($exclude as $excludedParam) {
         if (array_key_exists($excludedParam, $params)) {
             unset($params[$excludedParam]);
         }
     }
     return $params;
 }
开发者ID:larabros,项目名称:elogram,代码行数:19,代码来源:UrlParserTrait.php

示例11: getQueryParam

 /**
  * Get a query parameter from a PSR-7 UriInterface
  *
  * @param UriInterface $uri
  * @param string $param
  *
  * @return string|array|null
  */
 public function getQueryParam(UriInterface $uri, $param)
 {
     if (!($query = $uri->getQuery())) {
         return null;
     }
     parse_str($query, $params);
     if (!array_key_exists($param, $params)) {
         return null;
     }
     return $params[$param];
 }
开发者ID:quickenloans-mcp,项目名称:mcp-panthor,代码行数:19,代码来源:URI.php

示例12: getRequestTarget

 /**
  * {@inheritdoc}
  */
 public function getRequestTarget()
 {
     if ($this->requestTarget) {
         return $this->requestTarget;
     }
     $target = $this->uri->getPath();
     $target = $target ? $target : '/';
     $query = $this->uri->getQuery();
     $target .= $query ? '?' . $query : '';
     return $target;
 }
开发者ID:tlumx,项目名称:framework,代码行数:14,代码来源:Request.php

示例13: getQueryParams

 /**
  * Retrieve query string arguments.
  *
  * Retrieves the deserialized query string arguments, if any.
  *
  * Note: the query params might not be in sync with the URI or server
  * params. If you need to ensure you are only getting the original
  * values, you may need to parse the query string from `getUri()->getQuery()`
  * or from the `QUERY_STRING` server param.
  *
  * @return array
  */
 public function getQueryParams()
 {
     if ($this->queryParams) {
         return $this->queryParams;
     }
     if ($this->uri === null) {
         return [];
     }
     parse_str($this->uri->getQuery(), $this->queryParams);
     // <-- URL decodes data
     return $this->queryParams;
 }
开发者ID:Whiskey24,项目名称:GoingDutchApi,代码行数:24,代码来源:Request.php

示例14: getSelectedValues

 public function getSelectedValues(UriInterface $uri)
 {
     $queryParams = Psr7\parse_query($uri->getQuery());
     $selectedValues = [];
     foreach ($queryParams as $paramName => $params) {
         if (!isset($this->paramFacets[$paramName])) {
             continue;
         }
         $facetName = $this->paramFacets[$paramName];
         $selectedValues[$facetName] = $params;
     }
     return $selectedValues;
 }
开发者ID:sphereio,项目名称:commercetools-php-symfony,代码行数:13,代码来源:Search.php

示例15: resolve

 /**
  * Converts the relative URI into a new URI that is resolved against the base URI.
  *
  * @param UriInterface $base Base URI
  * @param UriInterface $rel  Relative URI
  *
  * @return UriInterface
  * @link http://tools.ietf.org/html/rfc3986#section-5.2
  */
 public static function resolve(UriInterface $base, UriInterface $rel)
 {
     if ((string) $rel === '') {
         // we can simply return the same base URI instance for this same-document reference
         return $base;
     }
     if ($rel->getScheme() != '') {
         return $rel->withPath(self::removeDotSegments($rel->getPath()));
     }
     if ($rel->getAuthority() != '') {
         $targetAuthority = $rel->getAuthority();
         $targetPath = self::removeDotSegments($rel->getPath());
         $targetQuery = $rel->getQuery();
     } else {
         $targetAuthority = $base->getAuthority();
         if ($rel->getPath() === '') {
             $targetPath = $base->getPath();
             $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
         } else {
             if ($rel->getPath()[0] === '/') {
                 $targetPath = $rel->getPath();
             } else {
                 if ($targetAuthority != '' && $base->getPath() === '') {
                     $targetPath = '/' . $rel->getPath();
                 } else {
                     $lastSlashPos = strrpos($base->getPath(), '/');
                     if ($lastSlashPos === false) {
                         $targetPath = $rel->getPath();
                     } else {
                         $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath();
                     }
                 }
             }
             $targetPath = self::removeDotSegments($targetPath);
             $targetQuery = $rel->getQuery();
         }
     }
     return new Uri(Uri::composeComponents($base->getScheme(), $targetAuthority, $targetPath, $targetQuery, $rel->getFragment()));
 }
开发者ID:nystudio107,项目名称:instantanalytics,代码行数:48,代码来源:UriResolver.php


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