<html>
<head>
<title>
Hello!
</title>
</head>
<body>
<?
function get_hitcount($counter_file)
{
$count=0;
if ( file_exists($counter_file) )
{
$fp=fopen($counter_file,"r");
$count=0+fgets($fp,20); //20表示数字的最大位数
fclose($fp);
}
$count++;
$fp=fopen($counter_file,"w");
fputs($fp,$count);
fclose($fp);
return ($count);
}
$count=get_hitcount("count/counter.txt");
echo "你是本站第$count位访问者";
?>
</body>
</html>