Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Cookie源码解析 #4

Open
kevinyan815 opened this issue Sep 1, 2018 · 1 comment
Open

Laravel Cookie源码解析 #4

kevinyan815 opened this issue Sep 1, 2018 · 1 comment

Comments

@kevinyan815
Copy link
Owner

kevinyan815 commented Sep 1, 2018

Laravel Cookie源码分析,首先还是从Cookie如何在Laravel中应用开始逐步讲解Laravel框架中Cookie的服务注册、生成Cookie以及获取Cookie。 梳理过程中发现Laravel在设置Cookie时全程没有调用过PHP原生的setcookie函数,而是通过依赖的Symfony框架的Response对象将Cookie先暂存在其引用的headers对象里最后在响应发送给客户端时前的send方法里将Cookie设置到了响应首部字段Set-Cookie中。

文章比较长,有不明白的地方可以留言,我有时间了一定会第一时间回复。

文章链接:https://github.com/kevinyan815/Learning_Laravel_Kernel/blob/master/aritcles/Cookie.md

@kylesean
Copy link

kylesean commented Nov 5, 2018

是的,laravel作者可能觉得php原生cookie的设计可能不够好。比如,存储方式是以文件形式存储,用户多了,会同时产生大量的session文件,并且通过名称查找对应的session文件效率很低。还有原生session内容未加密等问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants