我的 cookie 有问题,这是我下面的代码,但我收到无法修改标头错误。我读到一旦您向用户发送信息就会发生这种情况,但我没有发送任何内容。我有吗?
任何帮助,将不胜感激。谢谢!
<?php
$activities=array("Play Guitar","Write \"Timeless Legend\"","Develop","Dungeons and Dragons Quest","Photography","Android");
$used[0]=null;
$used[1]=null;
$used[2]=null;
$used[3]=null;
$used[4]=null;
$used[5]=null;
if (isset($_COOKIE['cookiesSet'])){
for($h=0;$h<=5;$h++){
$used[$h]=$_COOKIE[$h];
}}
else{
for ($i=0; $i<=5;$i++){
$rand=rand(0,5);
while($used[$rand]!=null){
$rand=rand(0,5);}
$used[$rand]=$activities[$i];
}
$midnight = strtotime('midnight', time());
for ($p=0;$p<=5;$p++){
setCookie($p,$used[$p],$midnight);
}
setCookie('cookiesSet','pollin',$midnight);
}
?>
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Time Manager</TITLE>