codeIgniter曲奇工作在FF,但不是Chrome或IE浏览器 [英] CodeIgniter Cookies Working In FF, But Not Chrome Or IE

查看:180
本文介绍了codeIgniter曲奇工作在FF,但不是Chrome或IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了CI的一个网站,有一个登录系统,这在Firefox而不是Chrome或IE浏览器工作正常。在这两个如果用户名和密码是否正确,它只是重定向(我认为)返回到登录页面,而不是登录错误页面,或者到网站主页(因为它应该)。我注意到,它似乎并没有被设置在Chrome浏览器的cookie,但在FF一样。

I've built a site in CI, and have a login system, which works fine in Firefox but not Chrome or IE. In those two if the username and password are correct it just redirects (i think) back to the login page, not to the login error page, or to the site home (as it should). I've noticed that it doesn't seem to be setting a cookie in Chrome, but it does in FF.

下面是我在控制器中的code这设置cookie和身份验证后重定向:

Here's the code in my controller which sets the cookie and redirects after authentication:

            $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');    

任何想法,为什么这可能发生?

Any ideas why this might be happening?

感谢

推荐答案

检查,真正$ _SESSION设置。在CI可能需要正常退出冲洗掉在什么$此-sessionto'真正的'会话变量。

Check that $_SESSION really is set. On CI you may need to exit gracefully to flush out whats in $this-sessionto the 'real' session variable.

添加一个回波序列化($ _ SESSION),所以你知道怎么回事(前再导向)。

add a echo serialize($_SESSION) so you know whats going on (before the redir).

和检查如何优雅地结束的C-要求。

and check how to end a Ci-request gracefully.

这篇关于codeIgniter曲奇工作在FF,但不是Chrome或IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆