yii用户退出操作public function actionLogout() { Yii::$app->user->logout(); return $this->goHome(); }登录后复制判断用户是否登录 public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } }登录后复制推荐学习:yii框架