PHP 中的 filemtime() 函数

phpprogrammingserver side programming

filemtime() 函数返回文件的最后修改时间。它以 UNIX 时间戳的形式返回文件的最后修改时间,如果失败则返回 false。

语法

filemtime ( file_path );

参数

  • file_path − 将找到最后修改时间的文件的路径。

返回

filemtime() 函数以 UNIX 时间戳的形式返回文件的最后修改时间,如果失败则返回 false。

示例

<?php
   echo filemtime("info.txt");
?>

输出

16127342863

现在让我们以人类可读的形式获取文件的最后修改时间。

示例

<?php
   echo "Last modification time of the file: ".date("F d Y H:i:s.",filectime("info.txt"));
?>

输出

Last modification time of the file: September 24 2018 07:55:51

相关文章