/* * Load system */ require SYSPATH . 'router.php'; require SYSPATH . 'loader.php'; require SYSPATH . 'controller.php'; require SYSPATH . 'model.php'; require SYSPATH . 'library.php'; require SYSPATH . 'i18n.php'; /* * Understand URL and decompose route */ $router = new Router(empty($_SERVER['PATH_INFO']) ? '' : $_SERVER['PATH_INFO']); $controller = $router->get_controller(); $method = $router->get_method(); $args = $router->get_args(); /* * Load requested controller */ $not_found = true; $controller_file = APPPATH . 'controllers/' . $controller . '.php'; if (file_exists($controller_file) && is_readable($controller_file)) { include $controller_file; $a = new $controller(); if (method_exists($a, $method)) { $not_found = false; call_user_func_array(array($a, $method), $args); } } if ($not_found) { http_response_code(404);