我想让用户一直登录到我的网站,直到他们注销(清除cookie)。直到关闭浏览器后,它才起作用。当我们关闭浏览器时,有没有一种存储cookie的好方法。
Cookie
in php has feature to set time
so you can specify time for it
setcookie($cookie_name, $cookie_value, time() + (86400 * 30)); // whatever time you need ,864000 = 1day
You have to use $_COOKIE
and functions
such as setCookie()
More help: http://php.net/manual/en/features.cookies.php
try this,
setcookie($cookie_name, $val, time()-3600);
i hope it will be helpful.
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.