当前位置:网站首页>带你深入了解Cookie
带你深入了解Cookie
2022-08-05 05:21:00 【lsely】
带你深入了解Cookie
此文只是介绍Cookie一些基础知识和构成Cookie的组成部件,并不介绍用法。
Cookie是什么鬼?
Cookie , 在百度百科中的介绍是指"储存在用户本地终端上的数据",用人话来说就类似于浏览器在本地的缓存,它是网站用来识别用户的一个文本。一般来说,在我们打开网站时,网站的Web服务器会为用户生成一个ID信息,可以说这就是用户的网络”身份证“,然后这个”身份证“就会保存到用户的电脑本地,以后如果用户再次登入这个网站,Web服务器就可以读取这个文本,就可以获取用户的各个信息了,这个过程也就是登录。
Cookie的发送机制
总体来说,每当我们第一次登录一个网站时,Web服务器就会发送一个Cookie到用户本地,在以后的登录中,用户本地的Cookie就会发送到Web服务器,从而验证自己的账户,用一张图来表示:
Cookie的组成
Cookie本质上还是一个文本数据,一般这个数据是经过加密的,由名称,值,还有几个用于控制Cookie使用范围或有效时间等量组成。
- 名称和值 Name/Value:Cookie的名称以及值。
- 有效期 Expires:Cookie的有效期。Expriers分为两种存储方式:会话性与持久性。会话性Cookie,保存在用户的内存中,会在推出浏览器时清空;而持久性Cookie会保存在用户的本地硬盘中,直至用户退出登录时才会失效 。说人话就是一个临时存储,一个长久存储。
- 使用范围 Domain:Cookie的使用于访问范围。
- 安全性 Secure:Cookie是否使用Https协议。
总结
Cookie是网站用于识别用户身份,保存在用户本地上的数据(经过加密),由用户本地暂时或长久保存的文本数据,一般由名称,值,有效期,使用范围等组成。
边栏推荐
- 正则表达式小实例--验证邮箱地址
- 传输层协议
- Getting Started Document 09 Standalone watch
- CIPU, what impact does it have on the cloud computing industry?
- Switch principle
- The spark operator - repartition operator
- 硬盘分区和永久挂载
- Getting Started 05 Using cb() to indicate that the current task is complete
- The highlight moment of operation and maintenance starts with intelligence
- In-depth Zabbix user guide - from the green boy
猜你喜欢
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
Account and Permission Management
IP packet format (ICMP protocol and ARP protocol)
markdown editor template
[Day1] (Super detailed steps) Build a soft RAID disk array
单臂路由与三成交换机
【Day5】软硬链接 文件存储,删除,目录管理命令
Getting Started Documentation 10 Resource Mapping
What?CDN cache acceleration only works for accelerating static content?
OpenCV3.0 is compatible with VS2010 and VS2013
随机推荐
Operation and maintenance engineer, come and pick up the wool
CIPU, what impact does it have on the cloud computing industry?
IP packet format (ICMP protocol and ARP protocol)
Getting Started Documentation 12 webserve + Hot Updates
network issue?Service packet loss?This is enough
TCP/IP four-layer model
入门文档10 资源映射
技术分享杂七杂八技术
spark source code-RPC communication mechanism
Getting Started Document 09 Standalone watch
运维工程师,快来薅羊毛
Hugo builds a personal blog
Small example of regular expression--validate email address
Switch principle
监控系统的内卷,有什么讲究?
入门文档03 区分开发与生产环境(生产环境才执行‘热更新’)
入门文档07 分阶段输出
[Day5] Soft and hard links File storage, deletion, directory management commands
IP地址及子网的划分
Disk management and file systems