douna1941 2010-11-24 16:06
浏览 39
已采纳

CodeIgniter Cookies在FF中工作,但不是Chrome或IE

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.

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?

Thanks

  • 写回答

6条回答 默认 最新

  • douli1854 2010-11-24 18:37
    关注

    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.

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

    and check how to end a Ci-request gracefully.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)