user->logout();return this->redirect(['controller/method name']);" statement to log out."/> user->logout();return this->redirect(['controller/method name']);" statement to log out.">
Home >PHP Framework >YII >How to log out of yii
yii user exit operation
public function actionLogout() { Yii::$app->user->logout(); return $this->goHome(); }
Judge whether the user is logged in
public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } }
Recommended learning: yii framework
The above is the detailed content of How to log out of yii. For more information, please follow other related articles on the PHP Chinese website!