如何在PHP中读取cookie到期时间[重复]

时间:2022-08-23 10:33:09

Possible Duplicate:
How to get cookie's expire time

可能重复:如何获取cookie的到期时间

Hi, How can i read cookie expiry time in PHP

嗨,我怎么能用PHP读取cookie到期时间

Thanks.

2 个解决方案

#1


3  

You can't, unless you store it elsewhere with your own mechanisms. Epxiry is a write-only field for cookies. Only the name and value of a cookie can be read once set. If the cookie is readable, it's not expired--that's all you get to know about that.

你不能,除非你用自己的机制存储在别处。 Epxiry是cookie的只写字段。设置后,只能读取cookie的名称和值。如果cookie是可读的,它就没有过期 - 这就是你所了解的全部内容。

#2


0  

You cannot read the cookie expiry time, because browsers do not send it to your server, only the value of cookies. Browsers send cookies back to the server in a HTTP header like this;

您无法读取Cookie到期时间,因为浏览器不会将其发送到您的服务器,只会发送cookie的值。浏览器在这样的HTTP头中将cookie发送回服务器;

Cookie: cookieName=cookieValue

The most common method of preventing cookies from expiring is setting an expiry date way in the future.

阻止cookie过期的最常用方法是在将来设置到期日期。

#1


3  

You can't, unless you store it elsewhere with your own mechanisms. Epxiry is a write-only field for cookies. Only the name and value of a cookie can be read once set. If the cookie is readable, it's not expired--that's all you get to know about that.

你不能,除非你用自己的机制存储在别处。 Epxiry是cookie的只写字段。设置后,只能读取cookie的名称和值。如果cookie是可读的,它就没有过期 - 这就是你所了解的全部内容。

#2


0  

You cannot read the cookie expiry time, because browsers do not send it to your server, only the value of cookies. Browsers send cookies back to the server in a HTTP header like this;

您无法读取Cookie到期时间,因为浏览器不会将其发送到您的服务器,只会发送cookie的值。浏览器在这样的HTTP头中将cookie发送回服务器;

Cookie: cookieName=cookieValue

The most common method of preventing cookies from expiring is setting an expiry date way in the future.

阻止cookie过期的最常用方法是在将来设置到期日期。