加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 客户端存储的cookie的时区是什么?

发布时间:2020-12-13 13:29:59 所属栏目:PHP教程 来源:网络整理
导读:我需要使用 PHP setcookie函数设置在1小时后过期的cookie.我服务器上的时区设置为GMT.我应该如何设置cookie到期日期,使其在不同客户端的浏览器时区中工作? 接近我可以告诉它客户时间是什么并不重要. PHP根据unix时间码设置过期时间.该时间的任何变化都应该
我需要使用 PHP setcookie函数设置在1小时后过期的cookie.我服务器上的时区设置为GMT.我应该如何设置cookie到期日期,使其在不同客户端的浏览器时区中工作?
接近我可以告诉它客户时间是什么并不重要. PHP根据unix时间码设置过期时间.该时间的任何变化都应该与服务器一起存在.

以下是PHP manual for setcookie()的摘录:

expire:

The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words,you’ll most likely set this with the time() function plus the number of seconds before you want it to expire. Or you might use mktime(). time()+60*60*24*30 will set the cookie to expire in 30 days. If set to 0,or omitted,the cookie will expire at the end of the session (when the browser closes).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读