以下代码在IE8上不起作用。 我尝试了print_r($ _COOKIE),但它返回了array(); 请帮我。
1 <?php
2 $currentTime = time();
3
4 $cookieName = "go.hyde";
5 $cookiePath = "/";
6 $cookieDomain = $_SERVER['SERVER_NAME'];
7 $cookieValue = strval($currentTime); // value is issue time (Unix Time)
8 $cookieExpire = strval($currentTime + 600); // expire is 10 minutes after issuing cookie
9
10 setcookie($cookieName,
11 $cookieValue,
12 $cookieExpire,
13 $cookiePath,
14 $cookieDomain);
15
答案 0 :(得分:1)
尝试没有cookie路径和cookie域
setcookie($cookieName,$cookieValue,$cookieExpire);
检查IE中是否启用了cookie
==============编辑================
我想我明白了,试试这个:
<?
$currentTime = time();
$cookieName = "gohyde";
$cookieValue = strval($currentTime); // value is issue time (Unix Time)
$cookieExpire = strval($currentTime + 600); // expire is 10 minutes after issuing cookie
setcookie($cookieName,
$cookieValue,
$cookieExpire);
echo $_COOKIE[$cookieName];
?>
没有cookie路径和cookie域。和不 ”。”点在cookie名称中。