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


PHP RequestInterface::setMethod方法代碼示例

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


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

示例1: clientCall

 protected function clientCall($path, $method = 'GET', $data = array())
 {
     if ($this->request instanceof RequestInterface) {
         $this->request = $this->client->createRequest($method);
     }
     $this->request->setPath($path);
     $this->request->setMethod($method);
     $this->request->setQuery($data);
     if (isset($this->accessToken)) {
         $this->request->getQuery()->set('access_token', $this->accessToken);
     }
     $response = $this->client->send($this->request);
     return $response->json();
 }
開發者ID:gpascual,項目名稱:deezer-sdk-php,代碼行數:14,代碼來源:DeezerClient.php

示例2: modifyRedirectRequest

 private function modifyRedirectRequest(RequestInterface $request, ResponseInterface $response)
 {
     $config = $request->getConfig();
     // Use a GET request if this is an entity enclosing request and we are
     // not forcing RFC compliance, but rather emulating what all browsers
     // would do.
     $statusCode = $response->getStatusCode();
     if ($statusCode == 303 || $statusCode <= 302 && $request->getBody() && !$config->getPath('redirect/strict')) {
         $request->setMethod('GET');
         $request->setBody(null);
     }
     $previousUrl = $request->getUrl();
     $this->setRedirectUrl($request, $response);
     $this->rewindEntityBody($request);
     // Add the Referer header if it is told to do so and only
     // add the header if we are not redirecting from https to http.
     if ($config->getPath('redirect/referer') && ($request->getScheme() == 'https' || $request->getScheme() == $config['redirect_scheme'])) {
         $url = Url::fromString($previousUrl);
         $url->setUsername(null);
         $url->setPassword(null);
         $request->setHeader('Referer', (string) $url);
     } else {
         $request->removeHeader('Referer');
     }
 }
開發者ID:bangordailynews,項目名稱:bdnindex,代碼行數:25,代碼來源:Redirect.php

示例3: withMethod

 public function withMethod($method)
 {
     $this->expectedRequest->setMethod($method);
     return $this;
 }
開發者ID:lezhnev74,項目名稱:GuzzleHttpMock,代碼行數:5,代碼來源:RequestExpectation.php


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