Yii Framework user login session loss solution

Source: Internet
Author: User
This article describes how to solve the session loss problem in the Yii Framework. it solves the session loss problem by modifying the underlying code, which has some reference value, for more information about how to solve the Yii Framework user logon session loss problem, see the example in this article. We will share this with you for your reference. The details are as follows:

Recently, I used the YII Framework to log on to a project. sometimes I can log on and sometimes I cannot log on. After debugging for many times, I started to think it was a server configuration problem. I didn't know how to test it later, or sometimes the login session is lost. I couldn't help it. I asked, posted, and asked Danale in the group, no problems were found at the end.

I accidentally saw someone on the Internet saying that the yii session was lost. Finally, the solution is as follows:

Preliminary 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 the built-in functions of php by default:

Bool session_regenerate_id ([bool delete_old_session])

It's okay now. You also need to observe for a while.

I hope this article will help you design PHP programs based on the Yii Framework.

For more information about how to solve session loss caused by logon to Yii Framework users, visit PHP!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.