The example of this article describes the solution to the problem of user login session loss in Yii framework. I would like to share it with you for your reference. The details are as follows:
I recently worked on a project and used the YII framework. When users log in, sometimes they can log in and sometimes they cannot. After debugging it many times, I thought it was a server configuration problem at first. However, no matter how I tested it, it still failed to work. Sometimes the login session was still lost. I had no choice but to ask in the group, post, and ask experts for advice. In the end, no problem was found.
I accidentally saw someone on the Internet talking about the problem of yii session loss. Finally solved, solution:
Initial solution:
Open the file yii\framework\web\auth\CWebUser.php #700 or so, comment out the following statement
Yii::app()->getSession()->regenerateID(true);
He calls PHP’s built-in function by default:
bool session_regenerate_id ( [bool delete_old_session] )
There is no problem for the time being. It still needs to be observed for some time.
I hope this article will be helpful to everyone’s PHP program design based on the Yii framework.
For more articles related to solutions to the Yii framework user login session loss problem, please pay attention to the PHP Chinese website!