我想知道,如何使用带有链接的“filemtime”?
示例:
预先感谢您的帮助!
内置
http
包装器不支持 stat
系列功能,例如 filemtime
。所以:你不能。
HTTP 协议定义了一个您可以使用的
Last-Modified
标头字段。
使用卷曲:
$curl = curl_init('http://thegoodwebsite.net/i/banp.gif');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_FILETIME, true);
if (false !== curl_exec($curl)) {
$time = curl_getinfo($curl, CURLINFO_FILETIME);
echo 'remote time of the retrieved document: ', $time;
}
curl_close($curl);
如果你得到-1,它可能是未知的。