Пример #1
0
 static function run()
 {
     try {
         router::parseUrl();
         define("_LAYER_", router::$child);
         define("_MODULE_", router::$module);
         define("_ACTION_", router::$action);
         define("_CONTROLLER_", router::$controller);
         define("MOD_PATH", APP_PATH . "/" . _MODULE_);
         $class = _MODULE_ . "\\" . (_LAYER_ == "" ? "" : _LAYER_ . "\\") . _CONTROLLER_;
         if (class_exists($class)) {
             return (new $class())->{_ACTION_}();
         }
         http::error(404, "Can't load the file:{$class}.php");
     } catch (\Exception $e) {
         error::panic($e->getMessage());
     }
 }