Php 使用ZipArchive失败
我将使用PHP类创建一个Zip存档。但它仍然不起作用。 它不会失败,响应为1。他没有创建Zip文件Php 使用ZipArchive失败,php,html,mysql,css,Php,Html,Mysql,Css,我将使用PHP类创建一个Zip存档。但它仍然不起作用。 它不会失败,响应为1。他没有创建Zip文件 $zip = new ZipArchive; $res = $zip->open('qr_img/'.'ab387bas.zip'.'', ZipArchive::CREATE); if ($res === TRUE) { $zip->addFile($file, 'screen.png'); $zip->close(); } 每个人都知道答案吗?$file\u
$zip = new ZipArchive;
$res = $zip->open('qr_img/'.'ab387bas.zip'.'', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFile($file, 'screen.png');
$zip->close();
}
每个人都知道答案吗?
$file\u names
是要添加到zip中的文件数组
function zipFile($file_names,$archive_file_name)
{
$zip = new ZipArchive();
//create the file and throw the error if unsuccessful
if ($zip->open($archive_file_name, ZIPARCHIVE::OVERWRITE )!==TRUE) {
}
//add each files of $file_name array to archive
foreach($file_names as $files)
{
// $zip->addFile($files,$files);
$zip->addFromString(basename($files), file_get_contents($files));
}
$zip->close();
}
请看我的回答:回答“1”实际上是一个错误代码,请在internet上查找。它在页面底部:如果$res==1,则表示
不支持多磁盘zip存档
谢谢,但我能做些什么?如果zip是您自己生成的,请生成它,使其不是多磁盘。如果zip存档应该由用户上传,则向他们显示一条消息,说明同样的情况。