[求助]自己写的计数器出的问题??
<P><?php<BR> function counter()<BR> {<BR> $max_len = 8;<BR> $counterfile = "../zzx.txt";<BR> if(!file_exists($counterfile))<BR> {<BR> <FONT color=#ff3300>$counter = 0;</FONT><BR> $cf = fopen($counterfile,"w");<BR> flock($cf,3);<BR> fputs($cf,"0");<BR> fclose($cf);<BR> }<BR> else<BR> {<BR> $cf = fopen($counterfile,"r");<BR> flock($cf,3);<BR> <FONT color=#f70909> $counter = trim(fgets($cf,$max_len))+0;</FONT><BR> fclose($cf);<BR> }<BR> }<BR> if(session_is_registered("in")==false)<BR> {<BR> $counter=$counter+1; <FONT color=#0000ff>//这里是24行;<BR></FONT> $cf = fopen($counterfile,"w");<BR> flock($cf,3);<BR> fputs($cf,$counter);<BR> fclose($cf);<BR> }<BR> $counter_len = strlen($counter);<BR> for($i=1;$i<=($max_len-$counter_len);$i++)<BR> {<BR> echo "<img src='image/0.GIF'>";<BR> }<BR> for($i=1;$i<=$counter_len;$i++)<BR> {<BR> echo "<img src='image/".substr($counter,$i-1,1).".GIF>'";<BR> }</P><P><BR>?><BR><BR>错误:====<BR>Notice: Undefined variable: counter in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 24</P>
<P>Notice: Undefined variable: counterfile in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 25</P>
<P>Warning: flock(): supplied argument is not a valid stream resource in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 26</P>
<P>Warning: fputs(): supplied argument is not a valid stream resource in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 27</P>
<P>Warning: fclose(): supplied argument is not a valid stream resource in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 28</P>
<P>Notice: Undefined variable: max_len in d:\usr\www\html\phpexe\jishuqi\counter\tqjsq_do.php on line 31<BR><img src='image/1.GIF>'<BR>是counter变量没有值么??应该不会吧!!麻烦大家看看!!</P> 问题解决了!!自己又重新写了一遍就好了!!!!<br>麻烦大家能够看看这个帖子的问题,谢谢了!!<br>http://bbs.bc-cn.net/viewthread.php?tid=119739
页:
[1]
