What is the difference between Sessions and Cookies in PHP?

前端 未结 8 1886
无人及你
无人及你 2020-11-28 04:51

What is the distinction between Sessions and Cookies in PHP?

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 05:13

    The main difference between a session and a cookie is that session data is stored on the server, whereas cookies store data in the visitor’s browser.

    Sessions are more secure than cookies as it is stored in server. Cookie can be turned off from browser.

    Data stored in cookie can be stored for months or years, depending on the life span of the cookie. But the data in the session is lost when the web browser is closed.

提交回复
热议问题