实际上我的邮政编码存在问题......
<?php
$zip = new ZipArchive();
$ret = $zip->open('archive.zip', ZipArchive::OVERWRITE);
if ($ret !== TRUE) {
printf("Fail to open the archive %d", $ret);
} else {
$directory = realpath('../arch');
$options = array('add_path' => 'sources/', 'remove_path' => $directory);
$zip->addPattern('/\.(txt|evn)$/', $directory, $options);
printf("Click <a href=\"archive.zip\">here</a> to download");
$zip->close();
}
?>
它实际上有效,但我在某些文件上有一些像“é”的字符(这是必要的,我无法修改),当我下载档案时,每个“é”都变成“Ú”。 那么,任何解决方案? 它不像这个主题: Here 我没有使用addFile选项,而是使用addPattern