安装
参考 https://learnku.com/articles/16000
乱码解决
ZipRepository.php
public function each($callback)
{
for ($i = 0; $i < $this->archive->numFiles; ++$i) {
//skip if folder
$stats = $this->archive->statIndex($i);
if ($stats['size'] === 0 && $stats['crc'] === 0) {
continue;
}
// 这里做了修改
$rawName = $this->archive->getNameIndex($i, ZipArchive::FL_ENC_RAW);
$encode = mb_detect_encoding($rawName, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
$rawName = iconv($encode, 'UTF-8', $rawName);
call_user_func_array($callback, [
$stats['name'], $rawName
]);
}