public function login($username, $password) { //检查用户是否存在 $userInfo = $this->_getUserByName($username); if (empty($userInfo)) { throw new Exception("error"); } //检查password是否正确 if ($userInfo["password"] != $password) { throw new Exception("error"); } //如果存在 获取用户 放入session WF_Session::Set(self::SESSION_KEY_USER, $userInfo); }