Exemple #1
0
\* ------------------------------------------------- */
use Models\Connect;
$database = ['dsn' => 'mysql:host=localhost;dbname=db_trombi', 'password' => 'root', 'username' => 'antoine'];
Connect::setDB($database);
use Controllers\UserController;
$userController = new UserController();
/* ------------------------------------------------- *\
    Request
\* ------------------------------------------------- */
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$method = strtolower($_SERVER["REQUEST_METHOD"]);
/* ------------------------------------------------- *\
    Router
\* ------------------------------------------------- */
if ($method == 'get') {
    switch ($uri) {
        case "/":
            $userController->index();
            break;
        case "/":
            $userController->index();
            break;
    }
}
if ($method == 'post') {
    switch ($uri) {
        case 'store':
            $userController->store();
            break;
    }
}