用于检查上次修改链接的PHP脚本

Is there a basic php method that accepts a URL and retrieves the date last modified from the header?

It would seem like something php can do, but I'm not sure which object to check.

Thanks

Give this a go.. using cURL.

$c = curl_init('http://...');
curl_setopt($c, CURLOPT_HEADER, 1); // Include the header
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // Return the result instead of printing it
$result = curl_exec($c);

if (curl_errno($c))
    die(curl_error($c));

// $result now contains the response, including the headers

if (preg_match('/Last-Modified:(.*?)/i', $result, $matches))
    var_dump($matches[1]);

Thanks... I tried modifying your version a bit and this seems to work for me:

$c = curl_init('http://...');    
curl_setopt($c, CURLOPT_HEADER, 1); // Include the header    
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_FILETIME, 1);   
curl_exec($c);
$result = curl_getinfo($c);   

if (curl_errno($c))
    die(curl_error($c));

echo date('G:i M jS \'y',(int)$result['filetime']);