What is the difference between a Session and a Cookie?

后端 未结 8 2148

What is the difference between a Session and a Cookie?

What circumstances should each be used?

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 10:44

    • The main difference between cookies and sessions is that cookies are stored in the user's browser, and sessions are not. This difference determines what each is best used for.

    • A cookie can keep information in the user's browser until deleted. If a person has a login and password, this can be set as a cookie in their browser so they do not have to re-login to your website every time they visit. You can store almost anything in a browser cookie.

提交回复
热议问题