Ejemplo n.º 1
0
<?php

use app\components\Router;
Router::setRoute(['' => 'app\\controllers\\Home:index']);
Router::setRoute(['register' => 'app\\controllers\\Auth:register']);
Router::setRoute(['login' => 'app\\controllers\\Auth:login']);
Router::setRoute(['logout' => 'app\\controllers\\Auth:logout']);
Router::setRoute(['profile' => 'app\\controllers\\Profile:index']);
Ejemplo n.º 2
0
<?php

use App\Components\Router;
use App\Components\View;
use App\Components\Logger;
use App\Components\FunctionLibrary as FL;
// Front Controller
// 1. Общие настройки
ini_set('display_errors', 1);
error_reporting(E_ALL);
session_start();
// 2. Подключение системных файлов
define('ROOT', dirname(__FILE__));
require_once ROOT . '/components/autoload.php';
// 3. Вызов Router
try {
    $router = new Router();
    $router->run();
    FL::deleteLink();
} catch (Exception $e) {
    $logger = Logger::getInstance();
    $logger->setLog($e->getFile(), $e->getLine(), $e->getMessage());
    $view = new View();
    $view->error = $e->getMessage();
    $view->display('error.php');
}
Ejemplo n.º 3
0
<?php

use app\components\Router;
Router::setRoute(['/' => 'app\\controllers\\IndexController:index']);
Router::setRoute(['/index/add[/:num]' => 'app\\controllers\\IndexController:add']);
Router::setRoute(['/index/save' => 'app\\controllers\\IndexController:save']);
Router::setRoute(['/index/load' => 'app\\controllers\\IndexController:load']);
Router::setRoute(['/index/show' => 'app\\controllers\\IndexController:show']);