When should I use session variables instead of cookies?

前端 未结 12 725
囚心锁ツ
囚心锁ツ 2020-12-07 11:12

Session variables and cookies seem very similar to me. I understand the technical differences, but how do you decide when to use one vs. the other?

12条回答
  •  执念已碎
    2020-12-07 11:41

    • Always use sessions
    • Use cookies only if you need longer logged-in sessions - Then add a cookie with an encrypted user ID.

提交回复
热议问题