예제 #1
0
파일: Kernel.php 프로젝트: Rinkana/Lirith
 /**
  * Init done? Continue to the deeper layers for the output.
  */
 protected function run()
 {
     $router = new Router();
     try {
         $responseData = $router->route($this->request);
         $this->response->setMessageBody($responseData);
     } catch (RouteNotFoundException $e) {
         $this->response->notFound();
     }
 }
예제 #2
0
<?php

ini_set('display_errors', 'On');
require 'Core/Routing/Router.php';
include 'Core/Autoloader/Autoloader.php';
use Core\Routing;
$requestUri = trim(addslashes($_SERVER['REQUEST_URI']));
$routeParameters = array_diff(explode('/', $requestUri), array(''));
$router = new Routing\Router($routeParameters);
if ($router->loadControllerIfExist()) {
    if ($router->ifControllerHaveActionFromUrl()) {
        $router->getNumberOfActionArguments();
        $router->run();
    } else {
        throw new Exception('UNDEFINED ACTION!');
    }
} else {
    require 'Errors/404.php';
}