[英]Codeigniter can't delete cookies
I have a login script, and now I am trying to build a logout for it. 我有一个登录脚本,现在我正在尝试为它构建一个注销。 I am using both cookies and sessions within CodeIgniter, and despite doing the below, the cookies still manage to stick and I can't figure out why. 我在CodeIgniter中使用cookie和会话,尽管如下所示,cookie仍然设法坚持,我无法弄清楚原因。 Allegedly this is the way to kill cookies via CI but I logout, close the page, go to another page and print_r($_COOKIE)
and they will still be there. 据称这是通过CI杀死cookie的方法,但我退出,关闭页面,转到另一个页面和print_r($_COOKIE)
,他们仍然会在那里。
$this->session->sess_destroy();
delete_cookie('LongRemember', '', '0');
delete_cookie('AutoRemember', '', '0');
redirect('m/logout', 'refresh');
echo 'logged out';
Using the cookie helper you can delete a cookie in two ways: 使用cookie帮助程序,您可以通过两种方式删除cookie:
delete_cookie("name");
delete_cookie($name, $domain, $path, $prefix);
This function doesn't not accept expiry parameters. 此功能不接受到期参数。
Don't forget to load the helper: $this->load->helper('cookie');
不要忘记加载帮助程序: $this->load->helper('cookie');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.