The login status on Douyu website can be maintained for one week. If SESSION + COOKIE is used, what is the login status? Is it a pure COOKIE? The login status on Douyu website can be maintained for one week. If SESSION + COOKIE is used, what is the login status? Is it a pure COOKIE?
Reply content:
The login status on Douyu website can be maintained for one week. If SESSION + COOKIE is used, what is the login status? Is it a pure COOKIE?
Currently, it is quite popular to save the session id in the cookie and the session status on the server (for example, in redis, the key is the session id)
For websites with few visits, you can use session to add cookies. you can configure PHP. ini to set the Expiration Time (
Session. cookie_lifetime, session. gc_maxlifetime) is greater than one week.
The session is stored in the database, and it is convenient to access redis.
When logging on, save the session, such as your ID and user name, and set the validity period. when you perform another operation, if the session contains a matched ID and user name within the validity period, directly log on to the system.
For more information, see localStorage and sessionStorage.