当前位置:首页>>网络编程>>PHP教程>>正文

PHP计数器

文章出处:设计前沿收集 作者:未知 发布时间:2005-08-02 浏览次数:644
 <?php
  
  
  $counterFile = "balong.txt";//存储数值的文件名几路径
  
  function displayCounter($counterFile) {
   $fp = fopen($counterFile,"rw");
   $num = fgets($fp,5);
   $num += 1;
   print "您是第 "."$num"." 个看巴泷计数器的家伙";
   exec( "rm -rf $counterFile");
   exec( "echo $num > $counterFile");
  }
  
  if (!file_exists($counterFile)) {
   exec( "echo 0 > $counterFile");
  }
  
  displayCounter($counterFile);
  
  ?>
Google