$u_r_l->__construct()
Constructor.
$u_r_l->__construct(void);
$u_r_l->__construct(string $value);
$u_r_l->__construct(string $value, string $d = null, int $i = null);
Inspect URL properties:
Example:
$url = new URL('https://mecha-cms.com/directory/foo/bar?foo=bar&baz=qux#foo', '/directory');
echo $url; // Return the base URL
echo $url->protocol; // Return the URL protocol
echo $url->host; // Return the URL host name
echo $url->port; // Return the URL port if any
echo $url->d; // Return the URL directory if CMS is installed in a sub-folder
echo $url->path; // Return the URL path without page offset
echo $url->i; // Return the page offset if any
echo $url->current; // Return the full URL of current page including the `i`, `query` and `hash` property
echo $url->clean; // Return the clean URL of current page without the `i`, `query` and `hash` property
echo $url->query; // Return the URL query
echo $url->hash; // Return the URL hash stored in `$_COOKIE['hash']`
Note: Most of numeric path value at the end of URL path will be moved from
path
property toi
property. So, if we havehttps://mecha-cms.com/foo/bar/baz/1
then we would get/foo/bar/baz
in thepath
property and/1
in thei
property.