本文整理汇总了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;
}
示例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;
}