[英]Why is the Content-Length HTTP header from not the same as on disk file size?
If I use PHP's get_headers()
to return the Content-Length of an image file, why does this not match the size of the file if I save it to disk (OSX)? 如果我使用PHP的
get_headers()
返回图像文件的Content-Length,那么如果将其保存到磁盘(OSX),为什么它与文件的大小不匹配?
protected function checkRemoteFile($url)
{
$headers = get_headers($url,1);
$size = $headers['Content-Length'];
return $size;
}
可能是因为内容是使用Content-Encoding:gzip发送的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.