本文整理汇总了PHP中Nette\Http\Url::appendQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::appendQuery方法的具体用法?PHP Url::appendQuery怎么用?PHP Url::appendQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Http\Url
的用法示例。
在下文中一共展示了Url::appendQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupCallbackUrl
protected function setupCallbackUrl()
{
//Create and setup callback URL
$this->callback_url = new Url();
$this->callback_url->setScheme('http');
$this->callback_url->setHost('ws.audioscrobbler.com');
$this->callback_url->setPath('/2.0/');
//2.0 - API version
$this->callback_url->appendQuery("api_key={$this->key}");
if ($this->data_format == self::DATA_JSON) {
$this->callback_url->appendQuery('format=json');
}
//JSON result
}
示例2: render
public function render($rowData)
{
if ($this->_renderer) {
return call_user_func($this->_renderer, $this);
}
// Direct URL
if ($this->_url !== NULL) {
// URL callback
if (is_callable($this->_url)) {
$url = call_user_func($this->_url, $rowData);
} else {
$url = new Nette\Http\Url($this->_url);
foreach ($this->_table->getIdColumns() as $key) {
$url->appendQuery(array('record' . ucfirst($key) => isset($rowData->{$key}) ? $rowData->{$key} : NULL));
}
}
$this->element->href((string) $url);
// Standard action's URL
} else {
$this->element->href($this->_table->createActionLink($this->getName(), $rowData));
}
// Class
if (($class = $this->getClass($rowData)) !== NULL) {
$this->element->class .= " {$class}";
}
return (string) $this->element;
}
示例3: exec
/**
* Calls remote API.
*
* @param string
* @return mixed json-decoded result
* @throws \NetteAddons\IOException
*/
protected function exec($path)
{
try {
$url = new Url($this->baseUrl . '/' . ltrim($path, '/'));
if ($this->clientId && $this->clientSecret) {
$url->appendQuery(array('client_id' => $this->clientId, 'client_secret' => $this->clientSecret));
}
$request = $this->requestFactory->create($url);
$request->addHeader('Accept', "application/vnd.github.{$this->apiVersion}+json");
return \Nette\Utils\Json::decode($request->execute());
} catch (\NetteAddons\Utils\StreamException $e) {
throw new \NetteAddons\IOException('Request execution failed.', NULL, $e);
} catch (\Nette\Utils\JsonException $e) {
throw new \NetteAddons\IOException('GitHub API returned invalid JSON.', NULL, $e);
}
}
示例4: oauthResponse
/**
* Send OAuth response
* @param array|\Traversable $data
* @param string|null $redirectUrl
* @param int $code
*/
public function oauthResponse($data, $redirectUrl = NULL, $code = 200)
{
if ($data instanceof \Traversable) {
$data = iterator_to_array($data);
}
$data = (array) $data;
// Redirect, if there is URL
if ($redirectUrl !== NULL) {
$url = new Url($redirectUrl);
if ($this->getParameter('response_type') == 'token') {
$url->setFragment(http_build_query($data));
} else {
$url->appendQuery($data);
}
$this->redirectUrl($url);
}
// else send JSON response
foreach ($data as $key => $value) {
$this->payload->{$key} = $value;
}
$this->getHttpResponse()->setCode($code);
$this->sendResponse(new JsonResponse($this->payload));
}
示例5: appendQuery
public function appendQuery($value)
{
parent::appendQuery($value);
$this->queryArray = array();
\parse_str($this->getQuery(), $this->queryArray);
}