Javascript cookies vs php cookies [英] Javascript cookies vs php cookies
问题描述
javascript cookies和php cookies之间有区别吗?
Is there a difference between javascript cookies and php cookies?
推荐答案
HTTP Cookies 不是PHP的功能,也不是Javascript的一个功能:这些只是允许开发人员操作它们的编程语言。
HTTP Cookies are not a feature of PHP, nor a feature of Javascript : those are just programming languages that allow a developper to manipulate them.
JS和PHP的最大区别在于:
The biggest difference between JS and PHP is that :
- Javascript在客户端运行
- PHP在服务器端运行
但是cookie仍然存在相同:它们被定义为标准 - 请参阅 RFC 2965 。
But cookies are still the same : they are defined as a standard -- see RFC 2965.
不过,请注意现代浏览器实现无法从Javascript 访问的cookie(请参阅 httponly
选项 setcookie
) - 这意味着,取决于兄弟wser,以及设置cookie的方式,可能无法从Javascript访问。
Still, note that modern browsers implement cookies that are not accessible from Javascript (see the httponly
option of setcookie
) -- which means that, depending on the browser, and the way a cookie was set, it might not be accessible from Javascript.
这是一个安全措施 - 并不是之间的区别js cookies 和 php cookies :它只是某些cookie的属性。
This is a security measure -- and is not a difference between "js cookies" and "php cookies" : it's just a property of some cookies.
这篇关于Javascript cookies vs php cookies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!