1

すべてのリンクで「filemtime」を使用する方法を教えてください。

例: - get 用の私の PHP ファイル: http://mywebsite.org/getdate.php - 日付を取得するリンク: http://thegoodwebsite.net/i/banp.gif

よろしくお願いします。

4

1 に答える 1

1

組み込みのラッパーは、 などの機能ファミリーをhttpサポートしていません。だから:できません。statfilemtime

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 を取得した場合、それは不明である可能性があります。

于 2016-04-05T15:27:40.763 に答える