-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
25 lines (21 loc) · 875 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
require_once "App/Services/Router/Route.php";
use App\Services\Router\AltoRouter;
require_once "App/Services/Controller/path.php";
require_once "App/API/Classes/Users.php";
$router = new AltoRouter();
$router->map(GET,'/', 'homePage');
$match = $router->match();
if (is_array($match)) {
if (is_callable($match['target']))
call_user_func_array($match['target'], $match['params']);
else if (is_array($match['target']) && file_exists($adminDir."/Controllers/".$match['target'][0].'.php')) {
require_once $adminDir . "/Controllers/" . $match['target'][0] . '.php';
$nameCl = $match['target'][0];
$nameFunc = $match['target'][1];
$controller = new $nameCl();
$controller->$nameFunc($match['params']);
}
} else {
echo "404";
}