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.
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', ],
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); //注释掉这一行就可以了 }
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!