PHP计数器的问题
Code:<?php
$RHand = fopen("COUNT.TXT","rb") ;
$COUNT = fread($RHand,filesize("COUNT.TXT")); //读取文件
fclose($RHand);
If($_COOKIE['COUNTER-COOKIES']="1") //若该计数器的Cookies的值为1
{
echo "<hr><br><p align='center'>已访问该页的访问者有".$COUNT."位</p>";
}
else
{
setcookie('COUNTER-COOKIES','1',mktime(12,0,0,1,1,2050)); //写入判断是否访问该页的Cookies
$Hand = fopen("COUNT.TXT","w+");
$COUNT3 = $COUNT+1;
fwrite($Hand,$COUNT3); //写入文件
fclose($Hand);
echo "<hr><br><p align='center'>已访问该页的访问者有".$COUNT."位</p>";
}
?>
无论如何访问该网页,都是只会显示有0位访问者,清掉浏览器Cookies也如此。Count.txt文件已获得Owner、Group、Everyone三用户的写入权限。