/** * 渲染 * * @access protected * @return mixed */ protected function render() { $errorsController = Tiny::getErrorsController(); if ($errorsController !== null) { //由于用户自己定义错误处理 try { if ($this->code !== null) { $_GET['act'] = 'error_' . $this->code; $errorsController->setDatas($this->data); Tiny::app()->setController($errorsController); $errorsController->run(); } else { $_GET['act'] = 'error'; $this->sysError(); } } catch (Exception $e) { //如果系统文件有错误 那么交由系统系统错误。 $this->sysError(); } } else { $this->sysError(); } }
/** * 创建控制器 * * @access public * @return mixed */ public function createController() { $controllerName = Req::args('con') !== null ? ucfirst(Req::args('con')) : $this->defaultController; $controllerClass = $controllerName . 'Controller'; $widgetClass = $controllerName . 'Widget'; if (class_exists($controllerClass)) { return new $controllerClass(strtolower($controllerName), $this); } else { if (class_exists($widgetClass)) { return new $widgetClass($controllerName, $this); } else { if (Tiny::getErrorsController() !== null) { $errorsController = Tiny::getErrorsController(); return $errorsController; } else { return new Controller($controllerName, $this); } } } }