Files
2023-03-21 15:26:43 +08:00

45 lines
856 B
PHP

<?php
require_once "vendor/autoload.php";
require_once "utils/helper/helper.php";
$uri = strtok($_SERVER['REQUEST_URI'], "?");
$path = explode('/', $uri)[1];
empty($path) && $path = 'index';
switch ($path) {
case "api" :
$path = "api";
break;
case "doapi" :
$path = "api";
break;
case "ip" :
$_GET['act'] = $path;
$path = "index";
$_GET['ip'] = explode('/', $uri)[2];
break;
default:
$_GET['act'] = $path;
$path = "index";
break;
}
$handlerPath = HANDLER_PATH . '/' . $path . ".php";
if (!file_exists($handlerPath)) {
\utils\View::getInstance()->fetch("404");
exit;
}
try {
require_once $handlerPath;
} catch (Exception $e) {
\utils\View::getInstance()->fetch("404");
exit;
var_dump($e->getMessage());
}