Property | Type | Description | |
---|---|---|---|
$urlManager | URL manager to use for creating URLs |
Method | Description | |
---|---|---|
base ( boolean | string $scheme = false ) : string | Returns the base URL of the current request. | |
canonical ( ) : string | Returns the canonical URL of the currently requested page. | |
current ( array $params = [], boolean | string $scheme = false ) : string | Creates a URL by using the current route and the GET parameters. | |
ensureScheme ( string $url, string $scheme ) : string | Normalize URL by ensuring that it use specified scheme. | |
home ( boolean | string $scheme = false ) : string | Returns the home URL. | |
isRelative ( string $url ) : boolean | Returns a value indicating whether a URL is relative. | |
previous ( string $name = null ) : string | null | Returns the URL previously [[remember()|remembered]]. | |
remember ( string | array $url = '', string $name = null ) | Remembers the specified URL so that it can be later fetched back by BaseUrl::previous. | |
to ( array | string $url = '', boolean | string $scheme = false ) : string | Creates a URL based on the given parameters. | |
toRoute ( string | array $route, boolean | string $scheme = false ) : string | Creates a URL for the given route. |
Method | Description | |
---|---|---|
getUrlManager ( ) : |
||
normalizeRoute ( string $route ) : string | Normalizes route and makes it suitable for UrlManager. Absolute routes are staying as is while relative routes are converted to absolute ones. |
public static base ( boolean | string $scheme = false ) : string | ||
$scheme | boolean | string | the URI scheme to use in the returned base URL: - `false` (default): returning the base URL without host info. - `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]]. - string: returning an absolute base URL with the specified scheme (either `http`, `https` or empty string for protocol-relative URL). |
return | string |
public static current ( array $params = [], boolean | string $scheme = false ) : string | ||
$params | array | an associative array of parameters that will be merged with the current GET parameters. If a parameter value is null, the corresponding GET parameter will be removed. |
$scheme | boolean | string | the URI scheme to use in the generated URL: - `false` (default): generating a relative URL. - `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]]. - string: generating an absolute URL with the specified scheme (either `http`, `https` or empty string for protocol-relative URL). |
return | string | the generated URL |
protected static getUrlManager ( ) : |
||
return | URL manager used to create URLs |
public static home ( boolean | string $scheme = false ) : string | ||
$scheme | boolean | string | the URI scheme to use for the returned URL: - `false` (default): returning a relative URL. - `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]]. - string: returning an absolute URL with the specified scheme (either `http`, `https` or empty string for protocol-relative URL). |
return | string | home URL |
public static isRelative ( string $url ) : boolean | ||
$url | string | the URL to be checked |
return | boolean | whether the URL is relative |
protected static normalizeRoute ( string $route ) : string | ||
$route | string | the route. This can be either an absolute route or a relative route. |
return | string | normalized route suitable for UrlManager |
public static previous ( string $name = null ) : string | null | ||
$name | string | the named associated with the URL that was remembered previously. If not set, it will use [[\yii\web\User::returnUrlParam]]. |
return | string | null | the URL previously remembered. Null is returned if no URL was remembered with the given name. |
public static remember ( string | array $url = '', string $name = null ) | ||
$url | string | array | the URL to remember. Please refer to [[to()]] for acceptable formats. If this parameter is not specified, the currently requested URL will be used. |
$name | string | the name associated with the URL to be remembered. This can be used later by [[previous()]]. If not set, it will use [[\yii\web\User::returnUrlParam]]. |
public static to ( array | string $url = '', boolean | string $scheme = false ) : string | ||
$url | array | string | the parameter to be used to generate a valid URL |
$scheme | boolean | string | the URI scheme to use in the generated URL: - `false` (default): generating a relative URL. - `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]]. - string: generating an absolute URL with the specified scheme (either `http`, `https` or empty string for protocol-relative URL). |
return | string | the generated URL |
public static toRoute ( string | array $route, boolean | string $scheme = false ) : string | ||
$route | string | array | use a string to represent a route (e.g. `index`, `site/index`), or an array to represent a route with query parameters (e.g. `['site/index', 'param1' => 'value1']`). |
$scheme | boolean | string | the URI scheme to use in the generated URL: - `false` (default): generating a relative URL. - `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]]. - string: generating an absolute URL with the specified scheme (either `http`, `https` or empty string for protocol-relative URL). |
return | string | the generated URL |