src/includes/classes/Core/Utils/UrlCurrent.php
public function uri(bool $canonical = false): string
    {
        if (($uri = &$this->cacheKey(__FUNCTION__, $canonical)) !== null) {
            return $uri; // Cached this already.
        }
        $uri = $_SERVER['REQUEST_URI'];
        $uri = '/'.$this->c::mbLTrim($uri, '/');

        if ($canonical) { // Strip query/fragment.
            $uri = preg_split('/[?#]/u', $uri, 2)[0];
        }
        return $uri; // With or without query/fragment.
    }
public function uri(bool $canonical = false): string
    {
        if (($uri = &$this->cacheKey(__FUNCTION__, $canonical)) !== null) {
            return $uri; // Cached this already.
        }
        $uri = $_SERVER['REQUEST_URI'];
        $uri = '/'.$this->c::mbLTrim($uri, '/');

        if ($canonical) { // Strip query/fragment.
            $uri = preg_split('/[?#]/u', $uri, 2)[0];
        }
        return $uri; // With or without query/fragment.
    }
Current URI; with a leading `/`.

@since 150424 Initial release.

@param bool $canonical Canonical?

@return string Current URI; with a leading `/`.