frontcontroller.php
require_once SYS_PATH . 'core/controller.php'; require_once SYS_PATH . 'core/router.php'; class Bootstrap { public function init(Router $router) { $controller = $router->getController(); $method = $router->getAction(); $params = $router->getParams(); require_once APP_PATH . 'config/config.php'; $controller = $controller ? $controller : DEFAULT_CONTROLLER; $method = $method ? $method : DEFAULT_ACTION; $path_controller = APP_PATH . 'controllers/' . $controller . '.php'; require_once $path_controller; $controller = new $controller(); if (method_exists($controller, $method)) { } } else { } } }
router.php
class Router { protected $controller; protected $action; protected $params; public function __construct() { require APP_PATH . 'config/routes.php'; foreach ($route as $key => $value) { $key ); } } // Params //echo $this->getController() . ',' . $this->getAction() . ',' . $this->getParams() . '<br />'; } public function getController() { return $this->controller; } public function getAction() { return $this->action; } public function getParams() { return $this->params; } }