如何从 setcookie() 获取过期时间?
我有一个 cookie,仅适用于 ssl:
$data = $users->customer->getUsernames();
$data = join(",", $data);
setcookie('test_cookie', $data, time()+3600, '/root/en/server/',
'server.test.com', true);
现在,我如何获取此 cookie 的时间?
I have a cookie, which is working with ssl only:
$data = $users->customer->getUsernames();
$data = join(",", $data);
setcookie('test_cookie', $data, time()+3600, '/root/en/server/',
'server.test.com', true);
Now, how can i get time of this cookie?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTTP 请求中发送到服务器的 Cookie 内容仅包含您在 Cookie 中设置的变量/值,而不包含过期时间。如果需要,您可以在每次设置时“填充”cookie 值以包含过期时间。
The cookie contents sent in the HTTP request to your server only includes the variables/values that you set in the cookie, not the expiration time. If you want, you can "pad" the cookie value to include the expiration time each time you set it.