PHP-Course/exam/routes/routes.php
2024-07-13 17:59:54 +02:00

18 lines
431 B
PHP

<?php
$path = ltrim(str_replace(Config::getBasePath(), "", $_SERVER['REQUEST_URI']), "/");
try {
if (substr($path, 0, 3) === "api") {
if (strpos($path, "docs") === false) {
require_once __DIR__ . "/../$path/index.php";
} else {
Headers::redirect("index.html");
}
} else {
require_once __DIR__ . "/../pages/index.html";
}
} catch (Exception $e) {
require_once __DIR__ . "/../pages/500.php";
}