The URL is similar in function to CodeIgniter’s URL helper.
Base
Returns URL of home page. The only param, FALSE by default, can be set to TRUE if a secure URL is desired, or “match” if the URL generated should match the scheme of the current URI.
// Without secure scheme URL::base(); // With secure scheme URL::base(TRUE); // Match the scheme of the current URI URL::base('match');
Site
The site method is just like the base method, except that a path can be provided.
// Without secure scheme URL::site('example/path'); // With secure scheme URL::site('example/path',TRUE); // Match the scheme of the current URI URL::site('example/path','match');
Current
Return the current URI with or without the query string.
// With query string URL::current(); // Without query string URL::current(FALSE);
Anchor
Return an HTML anchor tag where the href is a site URL.
// Regular anchor URL::anchor('somepage','Some Page'); // Secure anchor URL::anchor('somepage','Some Page',TRUE); // Regular anchor with attribute(s) URL::anchor('somepage','Some Page',FALSE,' class="foo"');
Redirect
Redirect to another site URL. Redirect can be standard, secure, or match the current URI.
URL::redirect( $uri = '', $secure = FALSE, $method = 'location', $http_response_code = 302 );