开发者

PHP getting expiring time of a cookie

Can I get the expiring time of a cookie which is already set? For example, I have set a cookie:

setcookie("test_cookie","some value", time()+3600*24*30);

Now can i get the time when the test_cookie is expiring? One option could be that when i set the test_cookie, i can set the expiring time in another开发者_JAVA技巧 cookie, but i'm wondering if there's alternative, better way without setting other cookie?

Thanks.


Setting it in another cookie is the best method, that or simply appending it to the end of the data you're storing with a delimeter such as #.


There's no way to get the expiry time because the browser doesn't send it. So the olny way is to store the time somewhere in another cookie or in session maybe.


Check this link How to get cookie's expire time

cookie expiration date can be set in another cookie.This cookie can then be read later to get the expiration date

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜