How to read cookie expiry time in PHP [duplicate]
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.
精彩评论