2019-03-30 12:19:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Front controller
|
|
|
|
*
|
|
|
|
* PHP version 7.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Composer
|
|
|
|
*/
|
|
|
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
|
|
|
require dirname(__DIR__) . '/App/Config.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Error and Exception handling
|
|
|
|
*/
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
set_error_handler('Core\Error::errorHandler');
|
|
|
|
set_exception_handler('Core\Error::exceptionHandler');
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Routing
|
|
|
|
*/
|
|
|
|
$router = new Core\Router();
|
|
|
|
// Add the routes
|
|
|
|
$router->add('', ['controller' => 'Home', 'action' => 'index']);
|
|
|
|
$router->add('{controller}/{action}');
|
|
|
|
$router->AddPrefix(\App\Config::ROUTE_PREFIX);
|
2019-08-15 13:05:13 +00:00
|
|
|
try{
|
|
|
|
//echo $_SERVER['REQUEST_URI'];
|
|
|
|
$router->dispatch($_SERVER['REQUEST_URI']);
|
|
|
|
}catch (Exception $exception){
|
|
|
|
echo $exception;
|
|
|
|
}
|