public static function getUri($reload = false) { if ($reload || is_null(self::$uri)) { $uri = ''; if (!empty($_SERVER['PATH_INFO'])) { $uri = $_SERVER['PATH_INFO']; } else { if (isset($_SERVER['REQUEST_URI'])) { $uri = parse_url(self::getScheme() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], PHP_URL_PATH); } else { if (isset($_SERVER['PHP_SELF'])) { $uri = $_SERVER['PHP_SELF']; } else { $this->error(500, 'Unable to detect request URI'); } } } if (self::getBaseUri() !== '' && strpos($uri, self::getBaseUri()) === 0) { $uri = substr($uri, strlen(self::getBaseUri())); } self::$uri = '/' . ltrim($uri, '/'); } return self::$uri; }