简体   繁体   中英

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)?

protected function checkRemoteFile($url)
{
    $headers = get_headers($url,1);
    $size = $headers['Content-Length'];
    return $size;

}

可能是因为内容是使用Content-Encoding:gzip发送的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM