为了咱们村的安危着想,大家务必进来
请先看完相关贴再看以下内容: http://bbs.phpres.com/showth...
- 娱乐乐园,
$file"); } $file="D:/Apache/Apache2/htdocs/tmp/counter.txt"; display($file); ?> 这是一个访客计数器。可是却没办法累加。请指明" name=description>
作者 zyy0015 发布于 2003-08-01 分类:php基础编程
<?
function display($file){
$fopen=fopen($file,"rw");
$num=fgets($fopen,256);
$num=$num+1;
echo "您是我第"."$num"."位访客";
exec("echo $num>$file");
}
$file="D:/Apache/Apache2/htdocs/tmp/counter.txt";
display($file);
?>
这是一个访客计数器。可是却没办法累加。请指明
逛论坛交流:我的程序出错在哪里?
没有写入文件,不用调用外部命令吧,fputs,fwriter都可以写
<?
function display($file){
$fopen=fopen($file,"r");
$num=fgets($fopen,256);
$num=$num+1;
echo "您是我第"."$num"."位访客";
$fopen=fopen($file,"w");
fwrite($fopen, $num);
}
$file="counte.txt";
display($file);
?>
太感觉的。可以了。谢谢两位前辈!!
3 条回复
回复