if(!file_exists("/tmp/count.txt"))

解决方案 »

  1.   

    改為:
    <html>
    <head>
    <title>first program</title>
    </head>
    <body>
    <?php
    file_count();
    function file_count()
    {
     if(!file_exists("/tmp/count.txt"))
     {
      exec("echo 0 > /tmp/count.txt");
                 
               } 
      $f_open=fopen("/tmp/count.txt","r+");
      $f_size=filesize("/tmp/count.txt");
      $count=fgets($f_open,$f_size+1);
      $count+=1;
      fseek($f_open,0);
      fputs($f_open,$count);
      fclose($f_open);
      echo"本页已有".$count."人浏览";
      return $count;
     } 
    ?>
    </body>
    </html>仔細比較吧