PHP 中的 fileatime() 函数

phpprogrammingserver side programming

fileatime() 函数返回文件的最后访问时间。它以 UNIX 时间戳的形式返回文件的最后访问时间。如果失败则返回 false。

语法

fileatime ( file_path );

参数

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

返回

fileatime() 函数以 UNIX 时间戳的形式返回文件的最后访问时间。如果失败则返回 false。

示例

<?php
   echo fileatime("new.txt");
?>

输出

1315416291

现在让我们以人类可读的形式获取上次访问时间。

示例

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

输出

Last access time of the file: September 22 2018 11:23:52

相关文章