Beispiel #1
0
 public function infoAction()
 {
     $uid = $this->model->getUid();
     if (!$uid) {
         Util\Http::redirect('/demo/user/login');
     }
     $userInfo = $this->model->getUserInfo($uid);
     if (false === $userInfo) {
         $this->view->set('error_msg', '获取用户失败');
     }
     Library\Log::error('xxx');
     Library\Log::warning('xxx');
     Library\Log::notice('notice');
     $this->view->render(array('username' => $userInfo['name']), 'userinfo.php');
 }
Beispiel #2
0
 public static function run(Router $router)
 {
     $router->init();
     $controller = $router->controller();
     $action = $router->action();
     try {
         if (!Zan\Zan::class2file($controller)) {
             Zan\Zan::display40x();
         }
         $instance = new $controller();
         if (!method_exists($instance, $action)) {
             Zan\Zan::display40x();
         }
         $instance->{$action}();
     } catch (\PDOException $e) {
         Log::error($e);
         Zan\Zan::display50x('fetch data error');
     } catch (ZException $e) {
         var_dump($e);
         Log::error($e);
         Zan\Zan::display50x($e->getMessage());
     }
 }