论坛: 网站建设 标题: 计数器(二)下午改进版 复制本贴地址    
作者: lqfrla [lqfrla]    论坛用户   登录
aoming认为到目前为止,问题已有明确答案,本贴已被冻结,不再接受更多的回复

把数字换成图片显示

<html>
<head>
<title>访客计数器</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 36px;
color: #FF0000;
}
-->
    </style>
</head>
<body>
<div align="center">
      <p>
<?php
$counterfile = "./count/count.txt";

function dispcounter($counterfile)
{
$fp = fopen($counterfile,"rw");
global $num;
$num = fgets($fp,5);
$num +=1;
//echo "您是第".$num."位到访的客人";
exec("del $counterfile");
exec("echo $num > $counterfile");
}

if(!file_exists($counterfile))
{
exec("echo 0 > $counterfile");
}
dispcounter($counterfile);
echo "<p>";
?>
<?
$row = strlen($num);

for($i=0;$i<$row;$i++)
{
$image = substr($num,$i,1);
$str .="<img src=\"image/$image.gif\" width=\"10\" height=\"10\">";
}

?>



<span class="STYLE1"> <img src="image/bsd.JPG" width="81" height="83">计数器</span> </p>
      <p>&nbsp;</p>
      <p>开站至今已有<? echo $str ?>人访问本站</p>
</div>
</body>
</html>

地主 发表时间: 06-03-10 19:51

论坛: 网站建设

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号