/** * 框架主方法 !!! * * @return boolean */ public static function run() { $controller = ForceStringFrom('c'); //注意POST或GET中c和a变量名称被占用 $action = ForceStringFrom('a'); $controller = Iif($controller, $controller, self::$defaultController); $action = Iif($action, $action, self::$defaultAction); $app_file = "./controllers/" . $controller . ".php"; if (!is_file($app_file)) { self::debug("file[{$app_file}] does not exists."); return false; } else { require_once realpath($app_file); } $classname = 'c_' . $controller; if (!class_exists($classname, false)) { self::debug("class[{$classname}] does not exists."); return false; } $path[0] = $controller; $path[1] = $action; self::$C = new $classname($path); //实例化控件类, 设置为APP当前的控件对像 if (!method_exists(self::$C, $action)) { self::debug("method[{$action}] does not exists in class[{$classname}]."); return false; } return call_user_func(array(&self::$C, $action), $path); }