public static function DoAction() { self::Initialize(); try { self::$ControllerInfo = self::ParseController('/^\\/([a-zA-Z0-9_]+)\\/([a-zA-Z0-9]+)$/'); if (empty(self::$ControllerInfo['name']) || empty(self::$ControllerInfo['class'])) { WebUtils::JSAlert('错误的调用', WebUtils::REDIRECT_NO_REDIRECT); //TODO 友好提示 } $name = self::$ControllerInfo['name']; $class = self::$ControllerInfo['class']; $ControllerClass = self::GetControllerClass($name, $class); if ($ControllerClass === false) { WebUtils::JSAlert('不存在处理方法', WebUtils::REDIRECT_NO_REDIRECT); //TODO 友好提示 self::ResponseEnd(); } self::$Context = new $ControllerClass(); self::$Context->Initialize(); self::$TemplatePath = self::ParseTemplatePath($name, $class); if (self::$Context->GetDoActionName() === false) { self::$Context->Execute(); } else { self::$Context->ProcessDoAction(); } if (self::$Context->ShowTemplate) { if (is_file(self::$TemplatePath)) { include self::$TemplatePath; } else { NDebug::VerDump(self::$TemplatePath); WebUtils::JSAlert('不存在模版', WebUtils::REDIRECT_NO_REDIRECT); } } self::$Context->ResponseEnd(); } catch (Exception $ex) { WebUtils::Alert($ex->getMessage()); } }
public function JSAlert($msg, $redirect = WebUtils::REDIRECT_GOBACK, $isTop = false) { WebUtils::JSAlert($msg, $redirect, $isTop); $this->ResponseEnd(); }