简体   繁体   中英

zip via php has different size as via winrar

i create one zip archive via php and another zip archive via winrar, but from the same files.

size of two archives is different. the one via winrar is bigger (2 bytes).

why ? thanks.

OK NOW. zip was created correctly using php.

problem was that i was sending it using

header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$name);
header('Content-Length: ' . filesize($name));

and dont have there ob_start(); and ob_end_clean();

that's why the size of file which come via header was different.. anyway thanks for your help ;)

Could be plenty of reasons. My bet, since it is only 2 bytes, is that winrar adds a special identifying mark to the archive to know it was done by winrar.

The other possibility is that you can set different levels of compression, and your php zip function maybe set to a higher rate of compression. Either or could be true, only way to really find out is to use a hex editor and examine the two files and see where the difference may lay.

The other way to check is by zipping different file sizes (but the same files) and see if the difference is always two bytes. If it is always two bytes, well winrar adds an identifying mark. If it is not, well it is different compression rates.

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