开发者

How to read cookie expiry time in PHP [duplicate]

开发者 https://www.devze.com 2023-03-02 11:41 出处:网络
This question already has answers here: 开发者_开发知识库 Closed 11 years ago. Possible 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

精彩评论

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