本文整理匯總了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;
}