Home > Article > PHP Framework > What should I do if my yii session cannot be saved?
I have recently been working on a project using the YII framework. When users log in, sometimes they can log in and sometimes they cannot.
After debugging many times, I thought it was a server configuration problem at first. However, no matter how I tested it, it still failed. Sometimes the login session was lost. I had no choice but to ask in the group. , posted, asked for help, and finally found no problem. (Recommended study: yii tutorial)
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])
The above is the detailed content of What should I do if my yii session cannot be saved?. For more information, please follow other related articles on the PHP Chinese website!