好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php filemtime定时生成文件代码 - php文件操作

php filemtime定时生成文件代码

filemtime() 函数返回文件内容上次的修改时间,若成功,则时间以 Unix 时间戳的方式返回,若失败,则返回 false。

语法:filemtime(filename)

$path  =  "a.txt" ;  if (  file_exists (  $path  ) ){        $filetimes  =  filemtime ( $path );    $cutime  =time();    $uptime  = 900; //15分钟生成一次     if  ( $cutime - $filetimes > $uptime )   {         $h  =  fopen (  $path , 'w+'  );    fwrite(  $h , '到了更新的时间'  );    fclose(  $h  );       }     }  else   {     $h  =  fopen (  $path , 'w+'  );    fwrite(  $h , '文件不存在'  );    fclose(  $h  );  }

查看更多关于php filemtime定时生成文件代码 - php文件操作的详细内容...

  阅读:70次