Mecha CMS

Extract current URL data.

$u_r_l->__construct()

Constructor.

2.0.02.2.0
$u_r_l->__construct(void);
$u_r_l->__construct(string $in);

Example:

Inspect URL properties:

$url = new URL('http://mecha-cms.com/directory/foo/bar?foo=bar&baz=qux#foo');

echo $url; // Return the base URL
echo $url->scheme; // Return the URL protocol without the `://` suffix
echo $url->protocol; // Return the URL protocol with the `://` suffix
echo $url->host; // Return the URL host name
echo $url->port; // Return the URL port if any
echo $url->directory; // Return the URL directory if CMS is installed in a sub-folder
echo $url->path; // Return the URL path without the `i` property
echo $url->i; // Return the pagination index if any
echo $url->current; // Return the current URL including the `i` property
echo $url->query; // Return the URL query
echo $url->hash; // Return the URL hash

Note: Most of numeric path value at the end of URL path will be moved from path property to i property. So, if we have http://mecha-cms.com/foo/bar/baz/1 then we would get foo/bar/baz in the path property and 1 in the i property.