當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Uri::withScheme方法代碼示例

本文整理匯總了PHP中GuzzleHttp\Psr7\Uri::withScheme方法的典型用法代碼示例。如果您正苦於以下問題:PHP Uri::withScheme方法的具體用法?PHP Uri::withScheme怎麽用?PHP Uri::withScheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GuzzleHttp\Psr7\Uri的用法示例。


在下文中一共展示了Uri::withScheme方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: perform

 /**
  * {@inheritdoc}
  */
 public function perform(OperationInterface $operation, ConfigurationInterface $configuration)
 {
     $preparedRequestParams = $this->prepareRequestParams($operation, $configuration);
     $queryString = $this->buildQueryString($preparedRequestParams, $configuration);
     $uri = new Uri(sprintf($this->requestTemplate, $configuration->getCountry(), $queryString));
     $request = new \GuzzleHttp\Psr7\Request('GET', $uri->withScheme($this->scheme), ['User-Agent' => 'ApaiIO [' . ApaiIO::VERSION . ']']);
     $result = $this->client->send($request);
     return $result->getBody()->getContents();
 }
開發者ID:exeu,項目名稱:apai-io,代碼行數:12,代碼來源:GuzzleRequest.php

示例2: executeKohanaRequest

 private function executeKohanaRequest(ServerRequestInterface $request, $redirect = 0)
 {
     if ($redirect >= self::MAX_REDIRECTS) {
         throw new LogicException(sprintf('Maximum Number of redirects (%s) for url %s', self::MAX_REDIRECTS, $request->getUri()));
     }
     Request::$initial = $kohanaRequest = $this->getKohanaRequest($request);
     Request::$user_agent = self::USER_AGENT;
     $_FILES = $request->getAttribute('FILES');
     $kohanaResponse = $kohanaRequest->execute();
     $this->current = $request;
     $status = $kohanaResponse->status();
     if ($status >= 300 && $status < 400) {
         $redirectUri = new Psr7\Uri($kohanaResponse->headers('location'));
         $localUri = $redirectUri->withScheme(null)->withUserInfo(null)->withHost(null)->withPort(null);
         return $this->executeKohanaRequest(new Psr7\ServerRequest('GET', $localUri), $redirect + 1);
     }
     return $kohanaResponse;
 }
開發者ID:spiderling-php,項目名稱:kohana-driver,代碼行數:18,代碼來源:Loader.php


注:本文中的GuzzleHttp\Psr7\Uri::withScheme方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。