就是执行到以下代码的时候出的问题:
if ($remember=="checked") { //下次自动登录
Cookie::set('authcookie', authcode("$user[user_name]\t$user[user_id]\t1",'ENCODE'), 31536000);
} else { //不自动登录
Cookie::set('authcookie', authcode("$user[user_name]\t$user[user_id]\t0",'ENCODE'),);
}具体情况如下:
1.自动登录,所有浏览器都正常,cookie都有发送
2.不自动登录,只有IE内核浏览器正常,chrome和火狐发送的head中都没有authcookie
3.domain如果为IP,所有浏览器都正常,domain为域名,出现第2个问题.
完全不理解为什么。。
是和数据库有关系?上面的user变量是数据库的一个表
if ($remember=="checked") { //下次自动登录
Cookie::set('authcookie', authcode("$user[user_name]\t$user[user_id]\t1",'ENCODE'), 31536000);
} else { //不自动登录
Cookie::set('authcookie', authcode("$user[user_name]\t$user[user_id]\t0",'ENCODE'),);
}具体情况如下:
1.自动登录,所有浏览器都正常,cookie都有发送
2.不自动登录,只有IE内核浏览器正常,chrome和火狐发送的head中都没有authcookie
3.domain如果为IP,所有浏览器都正常,domain为域名,出现第2个问题.
完全不理解为什么。。
是和数据库有关系?上面的user变量是数据库的一个表
原型:
static function set($name,$value,$expire='',$path='',$domain='') {
if($expire=='') {
$expire = C('COOKIE_EXPIRE');
}
if(empty($path)) {
$path = C('COOKIE_PATH');
}
if(empty($domain)) {
$domain = C('COOKIE_DOMAIN');
}
$expire = !empty($expire)? time()+$expire : 0;
$value = base64_encode(serialize($value));
setcookie(C('COOKIE_PREFIX').$name, $value,$expire,$path,$domain);
$_COOKIE[C('COOKIE_PREFIX').$name] = $value;
}