我有这个用于创建cookie的代码
这适用于firefox和crome浏览器,但在IE中它一次又一次地创建cookie
if (!isset($_COOKIE["cook"])) {
$expire = time() + 60 * 60 * 24 * 30 * 2;
$data = array(
"ip" => $_SERVER['REMOTE_ADDR'],
"browser" => $_SERVER['HTTP_USER_AGENT'],
"create_time" => $now
);
$result = $db->insert("cookies", $data);
$cookie_id = $db->lastid;
$cookie_id = my_encrypt($cookie_id);
setcookie("cook", $cookie_id, $expire,"/","localhost");
} else {
$cookie_id = $_COOKIE["cook"];
}
每当我访问页面时,它都会创建新的cookie
答案 0 :(得分:0)
省略domain
setcookie()
- 参数