Mecha CMS

$u_r_l->root()

Return the base URL including the directory path relative to the server root if any, otherwise return null.

2.2.0

$u_r_l->root(void);

Example:

$url = new URL('https://mecha-cms.com/foo/bar/1?baz=qux#asdf', '/foo');

echo $url->root;

Result:

https://mecha-cms.com/foo