jslygxx24 发表于 2015-7-22 13:52:19

CI框架用COOKIE只能在当前C里面用,到其他C里就没有COOKIE了

function checklogin(){
      $wuan_username = htmlspecialchars(trim($this->input->post('username')));
      $wuan_password = trim(md5($this->input->post('pwd')));
      $remember      = $this->input->post('remember');
      $user = $this->login_m->check_user($wuan_username,$wuan_password);
      if(!empty($user)){
            if(!empty($remember)){
                setcookie("wuan_username",$wuan_username,time()+7*86400);
                setcookie("id",$user['id'],time()+7*86400);
            }else{
                setcookie("wuan_username",$wuan_username);
                setcookie("id",$user['id']);
            }
            header("location:".base_url('index_c/test'));
      }else{
            echo "<script>alert('用户名或密码不正确');history.go(-1);</script>";
      }
    }

只能在当前login的C用,然后跳转到index_c里 COOKIE就用不了了,求大神解决!

因為愛 发表于 2015-7-22 15:59:03

redirect()用ci框架这个函数跳转

jslygxx24 发表于 2015-7-24 11:17:28

因為愛 发表于 2015-7-22 15:59
redirect()用ci框架这个函数跳转

没用啊

ahcheqiu 发表于 2015-7-31 12:18:05

你用的setcookie是php自带的吧,用ci的set_cookie试试

左耳 发表于 2015-8-7 16:42:54

用户登录信息为什么不存在session里呢?:o
页: [1]
查看完整版本: CI框架用COOKIE只能在当前C里面用,到其他C里就没有COOKIE了