I was just wondering if there is a pre-made system to call a function when a cookie expires. I was wondering if there was something similar to:
setcookie('cookie', "Value!", time()+300, onexpire{/*Self destruct*/});
If not I can think of a different way to do it
As per knowledge there is no pre-made system for this. Actually its very difficult to achieve your requirement.
But you can create one more cookie that will store your first cookie expire time. And later on use second cookie to check expire time of first one and then call function.
Hope so this way will help your.
Cookies are stored in the client's browser. Browser will not tell the server when cookie expires.
But there are some work-arounds:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.