Home > PHP Framework > YII > What should I do if yii2 cannot log out?

What should I do if yii2 cannot log out?

藏色散人
Release: 2020-07-22 11:09:11
Original
2217 people have browsed it

The solution to the problem that yii2 cannot log out: First find and open the "session.php" file; then comment out the content of "@session_regenerate_id($deleteOldSession);" in the text.

What should I do if yii2 cannot log out?

yii2 login and logout problems

Specific problem:

yii2 only clears the browser After the cache, you can log in normally. After logging in, exit and jump to a blank page. If you enter the login page, it is also a blank page. Who has encountered such a problem? The login and exit codes are all built-in with the yii2 system. I originally thought After pasting the code, why is the function of pasting the code unavailable?

The login and exit procedures were written correctly, and the jump was normal. However, in the configuration file, the session was saved in redis, causing it to fail!

Recommended: "yiiTutorial"

'session' => [
            'class' => 'yii\redis\Session',
        ],
Copy after login

Solution:

vender/yiisoft/yii2/web Find the following code in /session.php:

 public function regenerateID($deleteOldSession = false)
    {
        // add @ to inhibit possible warning due to race condition
        // https://github.com/yiisoft/yii2/pull/1812
        //@session_regenerate_id($deleteOldSession);  //注释掉这一行就可以了
    }
Copy after login

The above is the detailed content of What should I do if yii2 cannot log out?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template