我已经在CI中构建了一个站点,并且有一个登录系统,在Firefox中可以正常工作,但不是Chrome或IE。在这两个,如果用户名和密码是正确的,它只是重定向(我想)回到登录页面,而不是登录错误页面,或网站家(应该)。我注意到它似乎没有在Chrome中设置cookie,但它在FF中。CodeIgniter Cookie在FF中工作,但不是Chrome或IE
下面是我的控制器,设置cookie和验证后重定向代码:
$newdata = array(
'username' => $_POST['login_username'],
'real_name' => $name,
'user_id' => $uid,
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
//echo $newdata;
redirect('/site/index');
任何想法,为什么这可能发生?
谢谢
也许这可以帮助:http://stackoverflow.com/questions/917475/creating-a-cookie-failing-with-safari-chrome-ie-but-working-with-ff – trix 2010-11-24 20:56:36
另一种解决方案可能是这个帖子。 http://stackoverflow.com/a/29114118/1226309 – mariofertc 2015-03-18 04:30:43