本文整理匯總了PHP中Nette\Http\Url::getRelativeUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::getRelativeUrl方法的具體用法?PHP Url::getRelativeUrl怎麽用?PHP Url::getRelativeUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nette\Http\Url
的用法示例。
在下文中一共展示了Url::getRelativeUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: min
/**
* Pro zadane URL vytvori URL na minimalizacni skript
* @param string $url
* @param int $width [optional]
* @param int $height [optional]
* @return string
*/
public function min($url, $width = NULL, $height = NULL, $topcut = FALSE)
{
$min = new Url($this->scriptUrl);
$min->setQueryParameter('file', $url);
if ($width) {
$min->setQueryParameter('w', $width);
}
if ($height) {
$min->setQueryParameter('h', $height);
}
if ($width && $height) {
$min->setQueryParameter('exact', TRUE);
if ($topcut) {
$min->setQueryParameter('topcut', TRUE);
}
}
$minUrl = "/" . $min->getRelativeUrl();
return $minUrl;
}
示例2: constructUrl
/**
* @param Application\Request $appRequest
* @param Http\Url $refUrl
* @return NULL|string
*/
public function constructUrl(Application\Request $appRequest, Http\Url $refUrl)
{
if (count($this->actionDictionary) > 0) {
$appRequest = clone $appRequest;
$params = $appRequest->getParameters();
$params['action'] = 'default';
// so the request matches with route with action dictionary
$appRequest->setParameters($params);
}
$url = parent::constructUrl($appRequest, $refUrl);
if ($url === NULL) {
return NULL;
}
$httpUrl = new Http\Url($url);
$httpUrl->query = Strings::replace($httpUrl->query, '/action=([a-zA-Z0-9_+%-]*)/i', '');
return $httpUrl->getBasePath() . $httpUrl->getRelativeUrl();
}