简体   繁体   English

如何将 filemtime 与所有链接一起使用?

[英]How use filemtime with all link?

I would like to know, how use "filemtime" with all link ?我想知道,如何在所有链接中使用“filemtime”?

Example : - My PHP file for get is : http://mywebsite.org/getdate.php - The link that I want to get the date is : http://thegoodwebsite.net/i/banp.gif示例: - 我用于获取的 PHP 文件是: http : //mywebsite.org/getdate.php - 我想要获取日期的链接是: http : //thegoodwebsite.net/i/banp.gif

Thanks in advance for your help!在此先感谢您的帮助!

The built-in http wrapper doesn't support stat family of functionality, like filemtime .内置的http包装器不支持stat系列功能,例如filemtime So: you can't.所以:你不能。

HTTP protocol define a Last-Modified header field that you may use instead. HTTP 协议定义了一个Last-Modified标头字段,您可以改用它。 With CURL:使用卷曲:

$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); 

If you get -1 it might be unknown.如果你得到 -1 它可能是未知的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM