题
而不是文件本身?
修改强>
最好用PHP演示吗?
解决方案
<?php
// Get Headers
$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);
$response = curl_exec($ch);
// Process Headers
$headerLines = explode("\r\n", $response);
foreach ($headerLines as $headerLine) {
$headerLineParts = explode(': ', $headerLine);
if (count($headerLineParts) >= 2) {
$headers[$headerLineParts[0]] = $headerLineParts[1];
}
}
echo $headers['Last-Modified'];
?>
其他提示
是。 “HEAD”是指“HEAD”。 method只返回响应头而不是实际数据。
你可以使用php的get_headers函数
$a = get_headers('http://sstatic.net/so/img/logo.png');
print_r($a);
在您的HTTP请求中,您应该添加任何这些标题属性,您可能会收到304(最后修改)
- 如果-Modified-Since的
- 如果-无 - 匹配
- 如果未改性的-由于 醇>
Andrei是正确的,HEAD只会获得标题。如果符合条件,我的建议将只返回标题而不返回正文。如果内容已更新,正文将包含新信息。
您需要编写一些服务来处理http请求并提取所请求文件的最后修改日期并返回日期作为响应。
不隶属于 StackOverflow