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


PHP Url::setQuery方法代碼示例

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


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

示例1: buildRequestUrl

 /**
  * @param Actions\ActionsInterface $action
  * @param array                    $requestParams
  * @return Url
  */
 protected function buildRequestUrl(Actions\ActionsInterface $action, array $requestParams)
 {
     $url = new Url('https', $this->connection->getEndpoint());
     $url->setPath($action->getAction());
     $url->setQuery($requestParams);
     return $url;
 }
開發者ID:jdecoster,項目名稱:SlackBundle,代碼行數:12,代碼來源:Client.php

示例2: getEndpoint

 /**
  * The endpoint varies depending on developer mode, and whether the method is GET or POST.
  * If the method is GET, then the data needs to be added to the URL here. I've not found any
  * helper functions to construct URLs in omnipay, but they could be there.
  * It may also be possible to leave the URL construction to Guzzle, assuming Guzzle is able
  * to add an arbitrary list of query parameters to the endpoint that may already have some
  * query parameters.
  * CHECKME: it seems that Guzzle will accept an array containing a template and substitution
  * variables for its endpoint. This would avoid us needing to construct it here.
  */
 public function getEndpoint()
 {
     $domain = $this->getDeveloperMode() ? $this->endpointDevDomain : $this->endpointProdDomain;
     $path = $this->getPath();
     // Build the URL from the parts.
     // There is a dependency on Guzzle here, which OmniPay uses, but may be a
     // bit of an assumption in the longer term.
     $url = new Url($this->endpointScheme, $domain);
     $url->setPath($path);
     if ($this->getMethod() == 'GET') {
         $url->setQuery($this->getData());
     }
     return $url;
 }
開發者ID:academe,項目名稱:omnipay-helcim,代碼行數:24,代碼來源:AbstractRequest.php


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