示例#1
0
文件: Router.php 项目: hmc-soft/mvc
 public static function init($config)
 {
     $hooks = Hooks::get();
     if (isset($config['STATIC'])) {
         foreach ($config['STATIC'] as $stat_r) {
             self::$static_routes[] = $stat_r;
         }
     }
     if (isset($config['ROUTES'])) {
         //Routes defined in the config file.
         Router::parseConfig($config['ROUTES']);
     }
     if (isset($config['HOOKS']) && isset($config['HOOKS']['ROUTES'])) {
         //These call a function on the controller to setup the routes.
         //This is the preferred method for projects with a large number of routes.
         foreach ($config['HOOKS']['ROUTES'] as $route) {
             Hooks::addHook('routes', $route);
         }
     }
     $hooks->run('routes');
 }