/** * 未找到控制器的时候设置勾子 * */ public static function montFor404Page() { Plugin::mount('cml.before_show_404_page', [function () { $cmdLists = Config::get('cmlframework_system_command'); $cmd = strtolower(trim(Cml::getContainer()->make('cml_route')->getAppName(), '/')); if (isset($cmdLists[$cmd])) { call_user_func($cmdLists[$cmd]); } }]); Plugin::hook('cml.before_show_404_page'); }
/** * 未找到控制器的时候设置勾子 * */ public static function montFor404Page() { Plugin::mount('cml.before_show_404_page', array(function () { $cmdLists = Config::get('cmlframework_system_command'); $cmd = trim(Route::$urlParams['path'], DIRECTORY_SEPARATOR); if (isset($cmdLists[$cmd])) { call_user_func($cmdLists[$cmd]); } })); Plugin::hook('cml.before_show_404_page'); }