|
发表于 2011-11-29 00:12:37
|
显示全部楼层
CI的session本身就是cookie。最保险的方法就是在session和cookie里面都保存这。
function set_session($str, $value) {
if($this->is_ie()){
//delete_cookie($str+"!!!!!!!!!!!");
$time = time()+3600*10;
$this->setCookie($str, $value,$time);
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$_SESSION [$str] = "";
$this->CI->session->unset_userdata ( $str );
$this->CI->session->set_userdata ( $str, $value );
$_SESSION [$str] = $value;
}else{
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$_SESSION [$str] = "";
$this->CI->session->unset_userdata ( $str );
$this->CI->session->set_userdata ( $str, $value );
$_SESSION [$str] = $value;
}
} |
|