The difference between a cookie and a session:
1. The cookie data is stored on the client's browser and the session data is placed on the server.
2, Cookies are not very secure, others can analyze cookies stored locally and make cookie spoofing
consider security should use the session.
3. Session will be saved on the server for a certain period of time. When access is increased, it will be more likely to occupy your server's performance
The cookie should be used in consideration of mitigating server performance.
4, a single cookie can not save more than 4K of data, many browsers restrict a site to save up to 20 cookies.
5, so personal advice:
Storing important information such as login information as session
Additional information can be placed in a cookie if it needs to be retained
This article is from the "Brick Blog" blog, please be sure to keep this source http://wsxxsl.blog.51cto.com/9085838/1872379
The difference between a cookie and a session