当前位置:网站首页>The difference between session and cookie
The difference between session and cookie
2022-07-03 13:05:00 【Ramien】
Preface
In school , Students need a student ID to enter the school ( If it is the first time to enter school , Will give you a student card , That is, it will create a cookie), The student ID here is equivalent to a cookie, Of course ,cookie There can be multiple , Security staff ( The server ) See you have a student ID , You are allowed to enter the school .
If you don't want to pass the student ID these things (cookie) To get into school , You can register information (session), The security guard will record you ( There will be one. sessionID, The only user ), In this way, if you want to enter the school in the future, you can pass the registration information (sessionID) To get into school .
Common ground
cookie and session Are used to identify the conversation mode of browser users .
( conversation : You open a browser , Click on multiple hyperlinks , The whole process from closing the browser can be called a session )
difference
- cookie The data is saved on the client side ,session Data is saved on the server side .
- cookie The action time of can be called setMaxAge Method to set the validity period , Even if the session is closed, it is still valid .session The function time of is that the session ends when it is closed .
- cookie Not very safe , Can analyze the data stored locally COOKIE And carry on COOKIE cheating , If the main consideration is to save important information , Should be used session.
- because session It will remain until the session ends , So when there are a lot of visits , Will affect performance , If you consider reducing server performance , Should be used cookie.
边栏推荐
- Some thoughts on business
- My creation anniversary: the fifth anniversary
- Using swift language features, write a pseudo-random number generator casually
- ncnn神经网络计算框架在香橙派OrangePi 3 LTS开发板中的使用介绍
- 并网-低电压穿越与孤岛并存分析
- C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
- 低代码平台国际化多语言(i18n)技术方案
- [judgment question] [short answer question] [Database Principle]
- Swift5.7 extend some to generic parameters
- Dojo tutorials:getting started with deferrals source code and example execution summary
猜你喜欢
并网-低电压穿越与孤岛并存分析
Deeply understand the mvcc mechanism of MySQL
Two solutions of leetcode101 symmetric binary tree (recursion and iteration)
Xctf mobile--app3 problem solving
Some thoughts on business
Attack and defense world mobile--ph0en1x-100
Integer case study of packaging
【数据库原理及应用教程(第4版|微课版)陈志泊】【第六章习题】
【数据库原理及应用教程(第4版|微课版)陈志泊】【SQLServer2012综合练习】
Xctf mobile--app2 problem solving
随机推荐
How to stand out quickly when you are new to the workplace?
Low code platform international multilingual (I18N) technical solution
剑指 Offer 12. 矩阵中的路径
Two solutions of leetcode101 symmetric binary tree (recursion and iteration)
C graphical tutorial (Fourth Edition)_ Chapter 13 entrustment: what is entrustment? P238
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep268
Sword finger offer 14- ii Cut rope II
An example of newtonjason
Enter the length of three sides of the triangle through the user, and calculate the area of the triangle, where the length is a real number
Idea full text search shortcut ctr+shift+f failure problem
Leetcode234 palindrome linked list
【数据库原理及应用教程(第4版|微课版)陈志泊】【第三章习题】
Seven second order ladrc-pll structure design of active disturbance rejection controller
[exercise 6] [Database Principle]
Method overloading and rewriting
Powerful avatar making artifact wechat applet
Grid connection - Analysis of low voltage ride through and island coexistence
Exploration of sqoop1.4.4 native incremental import feature
阿里 & 蚂蚁自研 IDE
4. 无线体内纳米网:电磁传播模型和传感器部署要点