只需要获得header信息就够了
print_r(get_headers('http://example.com/'));
或者
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$r = curl_exec($ch);
$header_lines = explode("\r\n", $r);
foreach ($header_lines as $line) {
$oneLine = explode(': ', $line);
if (count($oneLine) >= 2) {
$headers[$oneLine[0]] = $oneLine[1];
}
}
echo $headers['Last-Modified'];