Url Helper
Url Helper
Url helper provides a set of static methods for managing URLs.
Getting Common URLs
There are two methods you can use to get common URLs: home URL and base URL of the current request. In order to get home URL, use the following:
$relativeHomeUrl = Url::home(); $absoluteHomeUrl = Url::home(true); $httpsAbsoluteHomeUrl = Url::home('https');
If no parameter is passed, the generated URL is relative. You can either pass true
to get an absolute URL for the current schema or specify a schema explicitly (https
, http
).
To get the base URL of the current request use the following:
登录查看完整内容