简体   繁体   中英

How use filemtime with all link?

I would like to know, how use "filemtime" with all link ?

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

Thanks in advance for your help!

The built-in http wrapper doesn't support stat family of functionality, like filemtime . So: you can't.

HTTP protocol define a Last-Modified header field that you may use instead. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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