Cookies - PHP与Javascript [英] Cookies - PHP vs Javascript

查看:69
本文介绍了Cookies - PHP与Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于安全性和便利性哪些cookie更好PHP或Javascript?

With regards to security and convenience which cookies are better the PHP ones or the Javascript ones?

推荐答案

它们是相同的在这两种情况下,cookie都被发送到浏览器,存储在那里,浏览器会在每次请求时将其发送给您,直到它过期或被删除。

They are the same ones, in both cases the cookie is sent to the browser, stored there and the browser send it back to you every request until it expires or is deleted.

因此,你永远不应该使用cookie作为安全性,因为你的问题暗示了你认为重要的任何数据都不会被最终用户保持不变。

For that reason, you should never use cookie for security as your question implies nor for any data which you consider important to keep unaltered by the end user.

使用cookie时要记住五件事:

1 - 你不能相信它的内容

2 - 你不能认为它仍然会在下一个请求中出现

3 - 你不能相信它的内容

4 - 你不能假设用户从未访问过如果它不在那里

5 - 你不能相信它的内容

There are five things to always remember when you use cookie:
1 - you can not trust its content
2 - you can not assume it will still be there on the next request
3 - you can not trust its content
4 - you can not assume the user never visited before if it's not there
5 - you can not trust its content

如果你得到那个,ac从php或javascript中删除cookie只是一个对你来说更方便的问题。

If you get that, accessing cookie from php or javascript is simply a question of what's more convenient to you.

这篇关于Cookies - PHP与Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆