// 设定 cookie
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
// 刷新页面后,显示出来
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $value) {
echo "$name : $value
\n";
}
}
?> 上例将输出:three : cookiethree two : cookietwo one : cookieone
看下你的位置是不是不对,尽量写在Head里面,不然在其他地方会报错
你是怎么写的
SetCookie("MyCookie", "Value of MyCookie"); ?