且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取远程文件的最后修改日期

更新时间:2023-01-29 19:32:34

来自 php 的文章:>

<?php
// outputs e.g.  somefile.txt was last modified: December 29 2002 22:16:23.

$filename = 'somefile.txt';
if (file_exists($filename)) {
    echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));
}
?>

filemtime() 是这里的关键.但我不确定您是否可以获得 远程 文件的最后修改日期,因为服务器应该将其发送给您...也许在 HTTP 标头中?

filemtime() is the key here. But I'm not sure if you can get the last modified date of a remote file, since the server should send it to you... Maybe in the HTTP headers?