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