视频地址:https://www.youtube.com/watch?v=lNQAl71Abqc

课程幻灯片:https://slides.com/biezhi/session-and... JS Cookie:https://github.com/js-cookie/js-cookie

https://cdn.nlark.com/yuque/0/2021/png/576791/1620015352626-378a9cbe-e6e0-44ef-8b6e-1495c1ee4f0c.png#height=485&id=OddmG&originHeight=970&originWidth=1784&originalType=binary&ratio=1&size=355735&status=done&style=none&width=892

Cookie 是曲奇饼吗?

https://cdn.nlark.com/yuque/0/2021/png/576791/1620015465825-6c0bb341-6dc9-4a26-8e48-0c86a798a7a3.png#height=478&id=SEzxG&originHeight=956&originWidth=1788&originalType=binary&ratio=1&size=1406496&status=done&style=none&width=894

cookie是浏览器保存在用户电脑上的一小段文本,用来保存用户在网站上的必要的信息。Web页面或服务器告诉浏览器按照一定的规范存储这些信息,并且在以后的所有请求中,这些信息就会自动加在http请求头中发送给服务器,服务器根据这些信息判断不同的用户。并且cookie本身是安全的。

https://cdn.nlark.com/yuque/0/2021/png/576791/1620016314718-be80fe57-494d-4a8c-b01a-dc2cee7fbfd2.png#height=536&id=kUVhd&originHeight=1072&originWidth=1912&originalType=binary&ratio=1&size=357642&status=done&style=none&width=956

会话Cookie

持久Cookie

Session

https://cdn.nlark.com/yuque/0/2021/png/576791/1620016535845-0a3ed1b5-c71a-48e8-bcd3-c314904ef581.png#height=431&id=LQP24&originHeight=862&originWidth=1888&originalType=binary&ratio=1&size=277678&status=done&style=none&width=944

Session是依赖Cookie的