新建cnt.php
1 <?php 2 $n=file_get_contents('cnt.txt'); 3 $n++; 4 file_put_contents('cnt.txt',$n); 5 echo "document.write($n);";
在主页或者其它页面里面这样调用计数器:”你是第<script type=text/javascript src=cnt.php></script>位访问者“就可以了。