[php] 세션과 쿠키의 차이 (differences session and cookie)
필그램
·2017. 2. 24. 15:04
php에서 세션과 쿠키의 차이를 정리해 봅니다.
A Cookie
- Cookies are stored in the browser as a text file format.
- It is stored limit amount of data.It is only allowing 4kb[4096bytes
- we can access the cookies values easily. so it is less secure.
- a cookie can be stored for months or years depending on the lifespan of the cookie
- setting the cookie time to expire the cookie.
A Session
- a collection of data are stored in server side.
- can be larger than a cookie. Actually, It is stored an unlimited amount of data
- more secure than cookie as it is stored in server side.
- the data in the session is lost when the web browser is closed.
- using session_destory(), we will destroyed the sessions.
2) 1- Session stored Server side, however cookie is stored client side
2- Session is created and maintained by the web server or application server, however is created and maintained by the developer