What is the difference between Sessions and Cookies in PHP?

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

What is the distinction between Sessions and Cookies in PHP?

8条回答
  •  渐次进展
    2020-11-28 05:04

    Cookies are stored in browser as a text file format.It stores limited amount of data, up to 4kb[4096bytes].A single Cookie can not hold multiple values but yes we can have more than one cookie.

    Cookies are easily accessible so they are less secure. The setcookie() function must appear BEFORE the tag.

    Sessions are stored in server side.There is no such storage limit on session .Sessions can hold multiple variables.Since they are not easily accessible hence are more secure than cookies.

提交回复
热议问题