开发者

How to read cookie expiry time in PHP [duplicate]

This question already has answers here: 开发者_开发知识库 Closed 11 years ago.

Possible Duplicate:

How to get cookie's expire time

Hi, How can i read cookie expiry time in PHP

Thanks.


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.


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: cookieName=cookieValue

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜