public function parseUrl() { if (!empty($_SERVER['REQUEST_URI'])) { $url = $_SERVER['REQUEST_URI']; if (hasFirstSLash($url)) { $url = removeFirstLetter($url); } if (hasLastSLash($url)) { $url = removeLastLetter($url); } $url = explode('/', filter_var($url, FILTER_SANITIZE_URL)); $this->parsedUrl = $url; } return false; }
function removeLastSlash($url = null) { if (hasLastSLash($url)) { //удаляем последний слеш $url = substr($url, 0, -1); } return $url; }