search
Homephp教程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 );
}

本文链接:

收藏随意^^请保留教程地址.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment