编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛  
全能 ASP / PHP / ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
发新话题
打印

[求助]自己写的计数器出的问题??

[求助]自己写的计数器出的问题??

<?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变量没有值么??应该不会吧!!麻烦大家看看!!

TOP

问题解决了!!自己又重新写了一遍就好了!!!!
麻烦大家能够看看这个帖子的问题,谢谢了!!
http://bbs.bc-cn.net/viewthread.php?tid=119739
俺是只大菜鸟!!

TOP

发新话题