示例#1
0
            break;
        case "/logout":
            $frontController = new Controllers\FrontController();
            $frontController->logout();
            break;
        case "/dashboard":
            $productController = new Controllers\ProductController();
            $productController->index();
            break;
        default:
            $message = "page not found";
            view('front.page404', compact('message'), $status = '404');
            break;
    }
}
if ($method == 'post') {
    switch ($uri) {
        case "/command":
            $frontController = new Controllers\FrontController();
            $frontController->command();
            break;
        case "/store":
            $frontController = new Controllers\FrontController();
            $frontController->store();
            break;
        case "/login":
            $frontController = new Controllers\FrontController();
            $frontController->checkLogin();
            break;
    }
}
示例#2
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", true);
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__);
require "Library/AutoLoader.class.php";
$autoLoader = new \Library\AutoLoader();
$autoLoader->register();
try {
    $frontController = new \Controllers\FrontController($_SERVER["REQUEST_URI"]);
    $frontController->run();
} catch (\Exceptions\InvalidUrlException $e) {
    header("Location: notfound");
}