先在目录下建立一个count.txt文件,输入一个数值0.
<html>
<head>
<title></title>
</head>
<body>
<span>文本计数器实例</span>
<p>本页面已被访问的次数为:</p>
<?php
$count = file_get_contents("count.txt");
$count += 1;
echo "<h4> $count </h4>";
file_put_contents("count.txt",$count);
?>
</body>
</html>