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  >  Article  >  PHP Framework  >  How to log out of yii

How to log out of yii

尚
Original
2019-12-31 15:07:452507browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to log in to yiiNext article:How to log in to yii