When should I use session variables instead of cookies?

前端 未结 12 715
囚心锁ツ
囚心锁ツ 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条回答
  •  -上瘾入骨i
    2020-12-07 11:40

    Cookies can persist longer than a single session. However, cookies may also be deleted by the user, or you may have a user whose browser does not accept cookies (in which case only a server-side session will work).

提交回复
热议问题