<?php
function counter()
{
$max_len = 8;
$counterfile = "../zzx.txt";
if(!file_exists($counterfile))
{
$counter = 0;
$cf = fopen($counterfile,"w");
flock($cf,3);
fputs($cf,"0");
fclose($cf);
}
else
{
$cf = fopen($counterfile,"r");
flock($cf,3);
$counter = trim(fgets($cf,$max_len))+0;
fclose($cf);
}
}
if(session_is_registered("in")==false)
{
$counter=$counter+1; //这里是24行;
$cf = fopen($counterfile,"w");
flock($cf,3);
fputs($cf,$counter);
fclose($cf);
}
$counter_len = strlen($counter);
for($i=1;$i<=($max_len-$counter_len);$i++)
{
echo "<img src='image/0.GIF'>";
}
for($i=1;$i<=$counter_len;$i++)
{
echo "<img src='image/".substr($counter,$i-1,1).".GIF>'";
}
?>
错误:====
Notice: Undefined variable: counter in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 24
Notice: Undefined variable: counterfile in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 25
Warning: flock(): supplied argument is not a valid stream resource in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 26
Warning: fputs(): supplied argument is not a valid stream resource in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 27
Warning: fclose(): supplied argument is not a valid stream resource in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 28
Notice: Undefined variable: max_len in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 31
<img src='image/1.GIF>'
是counter变量没有值么??应该不会吧!!麻烦大家看看!!