How to get file creation time and modification time in php

伊谢尔伦
Release: 2016-11-24 09:37:23
Original
1763 people have browsed it

filemtime( string filename )
 
返回文件上次被修改的时间,出错时返回 FALSE。时间以 Unix 时间戳的方式返回,可用于date()。
 
例如:$a=filemtime("log.txt");
 
           echo"修改时间:".date("Y-m-d H:i:s",$a);
 
filectime( string filename )
 
返回文件上次 inode 被修改的时间,如果出错则返回 FALSE。时间以 Unix 时间戳的方式返回。
 
例如:$a=filectime("log.txt");
 
           echo"创建时间:".date("Y-m-d H:i:s",$a);
 
fileatime( string filename )
 
返回文件上次被访问的时间,如果出错则返回 FALSE。时间以 Unix 时间戳的方式返回。
 
例如:$a=fileatime("log.txt");
 
          echo"修改时间:".date("Y-m-d H:i:s",$a);
Copy after login


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!