PHP获取远程文件最后更新时间

PHP程序:
$url = 'http://www.js4j.com/index.html';
$headInf = get_headers($url,1);//获取文件头信息
print_r($headInf );//打印文件头信息
echo "\n";
echo $headInf['Last-Modified'];//输出文件最后更新时间
echo "\n";
echo strtotime($headInf['Last-Modified']);//输出最后更新时间UNIX时间戳

运行结果

Array
(
    [0] => HTTP/1.0 200 OK
    [Date] => Thu, 24 Apr 2008 12:12:31 GMT
    [Server] => Apache/2.0.54 (Unix)
    [Last-Modified] => Wed, 23 Apr 2008 16:49:41 GMT
    [ETag] => "c3fdc1-1bd6-1e7fb340"
    [Accept-Ranges] => bytes
    [Content-Length] => 7126
    [Content-Type] => text/html
    [Age] => 11394
    [X-Cache] => HIT from webfront4.js4j.com.cn
    [Connection] => close
)


你可能感兴趣的:(PHP获取远程文件最后更新时间)