簡體   English   中英

如何將 filemtime 與所有鏈接一起使用?

[英]How use filemtime with all link?

我想知道,如何在所有鏈接中使用“filemtime”?

示例: - 我用於獲取的 PHP 文件是: http : //mywebsite.org/getdate.php - 我想要獲取日期的鏈接是: http : //thegoodwebsite.net/i/banp.gif

在此先感謝您的幫助!

內置的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 它可能是未知的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM