您好,欢迎访问一九零五行业门户网

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 );}
本文链接:
收藏随意^^请保留教程地址.
其它类似信息

推荐信息