Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要知道上次使用 PHP 访问文件 (main.html) 的时间。我希望用户能够看到其他用户上次访问该页面的时间。如何使用 PHP 做到这一点?
函数 fileatime 用于获取给定文件的最后访问时间。
$filename = 'somefile.txt'; if (file_exists($filename)) { echo "$filename was last accessed: " . date("F d Y H:i:s.", fileatime($filename)); } // outputs e.g. somefile.txt was last accessed: December 29 2002 22:16:23.