当前位置:网站首页>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.
边栏推荐
- Glide 4.6.1 API initial
- 如何在微信小程序中获取用户位置?
- 【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)
- SLF4J 日志门面
- [exercice 7] [principe de la base de données]
- ncnn神經網絡計算框架在香柳丁派OrangePi 3 LTS開發板中的使用介紹
- elk笔记24--用gohangout替代logstash消费日志
- The latest version of blind box mall thinkphp+uniapp
- Understanding of CPU buffer line
- Export the entire Oracle Database
猜你喜欢
GaN图腾柱无桥 Boost PFC(单相)七-PFC占空比前馈
【数据库原理及应用教程(第4版|微课版)陈志泊】【SQLServer2012综合练习】
正则表达式
【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)
阿里 & 蚂蚁自研 IDE
Node.js: express + MySQL的使用
[network counting] Chapter 3 data link layer (2) flow control and reliable transmission, stop waiting protocol, backward n frame protocol (GBN), selective retransmission protocol (SR)
The upward and downward transformation of polymorphism
【数据挖掘复习题】
Idea full text search shortcut ctr+shift+f failure problem
随机推荐
Low code platform international multilingual (I18N) technical solution
Openstack node address change
2022-01-27 research on the minimum number of redis partitions
Nodejs+express+mysql realizes login function (including verification code)
剑指 Offer 14- II. 剪绳子 II
Sword finger offer 15 Number of 1 in binary
【習題五】【數據庫原理】
【习题六】【数据库原理】
Drop down refresh conflicts with recyclerview sliding (swiperefreshlayout conflicts with recyclerview sliding)
Brief introduction to mvcc
Dix règles de travail
【综合题】【数据库原理】
【数据库原理及应用教程(第4版|微课版)陈志泊】【第六章习题】
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
【数据库原理复习题】
【习题五】【数据库原理】
context. Getexternalfilesdir() is compared with the returned path
[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter IV exercises]
有限状态机FSM
Node. Js: use of express + MySQL