What should be stored in a cookie for a login system?

前端 未结 4 1642
予麋鹿
予麋鹿 2020-12-15 10:07

What is the best thing to store in a cookie to keep a persistent logged-in state?

I have seen many websites (and beginner tutorials!) that simply store something lik

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 10:40

    The only thing that should be in a cookie is the sessionid generated by PHP (and this is done automatically when you use sessions). You should not store anything in the cookie except maybe a remembered username for the purpose of a "remember me" checkbox.

提交回复
热议问题