user) { if ($this->request->isPost()) { try { $account = $this->request->post('account'); $password = $this->request->post('password'); $field = filter_var($account, FILTER_VALIDATE_EMAIL) ? 'email' : 'username'; Users::login($account, $password, $field); } catch (Exception $e) { $this->error($e->getMessage()); } $this->success('欢迎回来'); } return view('index/home'); } $this->assign('images_count', Images::cache(120)->count()); return $this->fetch(); } public function api() { $this->assign('domain', $this->request->domain()); return $this->fetch(); } }