php - N 不支持多磁盘 zip 存档
问题描述
我想使用 php zipArchive 将文件下载到 zip,但我收到此错误“不支持 N 多磁盘 zip 存档”。
解决方案
$file_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();
}
推荐阅读
- c# - 用我的链接替换字符串中的链接
- python - 重命名具有任意顺序和重复列名的多索引列
- sql - 在具有大量活动用户的项目中使用 ASP 身份用户
- reactjs - 卸载时 React Progressive Web App 添加到主屏幕不起作用
- postgresql - PostgreSQL - 为具有多对多关系的多个表创建数据库视图
- angular - 如何使用 Ionic 4 检测平台
- json - 如何从 JSON 对象中检索多个值
- c# - C# 将 ListViewGroup 标题文本更改为粗体
- php - Laravel 迁移不适用于新数据库
- git - 当我第一次从命令行推送现有存储库时