php - Designed a small news reading website, any questions about the use of cookies?
phpcn_u1582
phpcn_u1582 2017-05-16 13:05:11
0
4
536

Dear heroes, I have designed a small news reading/social networking website. I want to write the information of the interest groups to which the user belongs, as well as the serial number of the news the user has read today and the serial number of the news he has read, into the cookie information (of course The news list will be updated every day), is this design appropriate?

phpcn_u1582
phpcn_u1582

reply all(4)
Peter_Zhu

It is best to write each operation to redis and store it in the database when the business is at low peak every day. Neither session nor cookie storage is a good engineering implementation. And if the user clears the cache, won’t all the cookie data be lost?

phpcn_u1582

Cookies are best used only to store some simple user IDs. If you just store simple serial numbers, there is no problem. When it comes to account passwords, it is best to use sessions. There is no problem in logging in every day to update cookies.

为情所困

Yes, it is possible, but if there are too many, it will increase the complexity and may not be necessary

曾经蜡笔没有小新

Save it in the database. To facilitate future expansion. For example, just push cookies such as related news

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template