ZipArchive (using libzip) encodes comments in UTF-8/ASCII, but some softwares on Windows show comments in ANSI (such as GBK...), so we should :
<?php
$_charset = 'GBK';
$file = 'D:/boaphp.zip';
$comment = '中文ABC123';
$zip = new ZipArchive;
$res = $zip->open($file, ZipArchive::CREATE);
if ($res) {
if($_charset){ $zip->close();
$str = mb_convert_encoding($comment, $_charset, 'UTF-8');
$fh = fopen($file, 'r+b');
fseek($fh, -2, SEEK_END);
$str = pack('v', strlen($str)) . $str;
fwrite($fh, $str);
fclose($fh);
}else{ $zip->setArchiveComment($comment);
$zip->close();
}
}
?>