饼干插件登陆怎么用_用PHP烤饼干

本文介绍了HTTP协议中的cookies,用于维持用户状态的关键技术。详细讲解了PHP中设置、检索和更新cookies的过程,以及cookies的生命周期。文章还强调了在使用cookies时应注意的事项,包括浏览器对cookies数量和大小的限制,以及用户的隐私设置。最后,提醒开发者在用户禁用cookies时考虑其他保持状态的方法,如PHP会话。
摘要由CSDN通过智能技术生成

饼干插件登陆怎么用

Have you ever wondered that in spite of HTTP being a stateless protocol, when you log in to a website and buy stuff and checkout how the server can identify you uniquely? You might wonder if HTTP is stateless but your state is maintained through your interactions, isn’t this a contradiction? Welcome to world of cookies (not the ones which we can eat, btw :)), one the of primary ways to maintain user state and interaction between the web browser and the web server.

您是否曾经想过,尽管HTTP是无状态协议,但是当您登录网站并购买商品并检查服务器如何唯一地标识您时,您是否会感到好奇? 您可能想知道HTTP是否是无状态的,但是您的状态是通过交互来维护的,这不是矛盾吗? 欢迎来到cookie的世界(不是我们可以吃的cookie,顺便说一句:)),它是维护用户状态以及Web浏览器和Web服务器之间交互的主要方式之一。

Cookies are tid-bits of information stored by the browser on a user’s computer. The information stored in the cookie is used to uniquely identify a user and this information is sent to server with each request so server can make use of it. Cookies can store a variety of data, such as your name, the date of your last visit, shopping cart contents, etc. Cookies stored by one website can not be accessed by other websites, which makes cookies relatively safe to store personal information. Still, it is a good idea not to store sensitive information in them, like passwords and credit card information.

Cookies是浏览器存储在用户计算机上的信息的小知识。 Cookie中存储的信息用于唯一标识用户,并且此信息随每个请求发送到服务器,以便服务器可以使用它。 Cookies可以存储各种数据,例如您的姓名,您的上次访问日期,购物车内容等。一个网站存储的Cookies无法被其他网站访问,这使得Cookies相对安全地存储了个人信息。 不过,最好不要在其中存储敏感信息,例如密码和信用卡信息。

Cookie的生命周期 (The Lifecycle of a Cookie)

Here’s what the lifecycle of a PHP cookie looks like, from baking to eating:

这是从烘烤到食用PHP cookie的生命周期:

alt

There are no cookies when the browser connects to particular server for first time. When the request is made to the PHP script, the script makes a call to the setcookie() function. This causes a Set-Cookie HTTP header to be sent in the response that contains the name and value of the cookie to be set.

当浏览器首次连接到特定服务器时,没有cookie。 当向PHP脚本发出请求时,该脚本将调用setcookie()函数。 这将导致在响应中发送Set-Cookie HTTP标头,其中包含要设置的cookie的名称和值。

When the browser receives the respons

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值