获取远程文件的上次修改日期 [英] Get the last modified date of a remote file
本文介绍了获取远程文件的上次修改日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过curl获取远程文件的最后修改日期。有谁知道如何做到这一点?
I would like to get the last modified date of a remote file by means of curl. Does anyone know how to do that?
推荐答案
从 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?
这篇关于获取远程文件的上次修改日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文