Home  >  Article  >  PHP Framework  >  What should I do if my yii session cannot be saved?

What should I do if my yii session cannot be saved?

(*-*)浩
(*-*)浩Original
2019-11-07 10:22:492576browse

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.

What should I do if my yii session cannot be saved?

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!

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:what is yii2Next article:what is yii2