作者misatocat (天使级废材!)
看板PHP
标题cookie设置的问题
时间Mon Oct 24 16:43:08 2005
对於 php 我还算个新手,所以想请问一下各位大大
我想利用一组乱数来当做使用者的ID
下以,是我的程式码
if (!isset($id)) {
srand((double)microtime()*1000000);
$id = rand();
setcookie("id",$id,time()+14400,"/",".domain.name",0);
}
不过,这样设置,都会在 setcookie那边出现编码错误
Warning: Cannot modify header information - headers already sent by (output started at /home/test/public_html/index.php:6)
in /home/test/public_html/index.php on line 20
换了一些方式 ,总是会在setcookie那边出错
真的很伤脑筋............ㄒ又ㄒ
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 211.74.205.37