【问题标题】:Why is ZipArchive on WIndows creating Multi-Disk?为什么 ZipArchive 在 Windows 上创建多磁盘?
【发布时间】:2016-07-11 20:40:54
【问题描述】:

我根本无法让 ZipArchive 在 windows 下正常工作。

这段代码

    $returnValue = $zipArchive->open(sprintf('%s.zip',$case->getId()), \ZipArchive::CREATE);

    if (!is_resource($returnValue)){
        exit("".$returnValue."  ".sprintf('%s.zip',$case->getId()));
    }

    foreach($case->getFiles() as $file){
        $filePath = $cacheFileManager->getPathPrefix().$file->getLocation();
        if(file_exists($filePath)){
            $zipArchive->addFile($folderPath, basename($file->getName()));
        }else{
            exit($filePath);
        }
    }

    $zipArchive->close();

调用open函数后的返回值为

“1 d08efeaa-2819-11e6-ba08-2c56dc4a62f3.zip”

所以我猜由于某种原因会发生此错误“不支持多磁盘 zip 存档”。

我不知道我做了一些设置或更改。

还是说 ZipArchive 在 Windows 下不可用?我正在使用 PHP 7。

感谢您的建议

【问题讨论】:

    标签: php windows php-7 ziparchive


    【解决方案1】:

    所以我的错误是,布尔值被转换为字符串,结果是 1 而不是 true。

    其次,确保添加了一些文件。否则在关闭或许多其他操作时会出错。

    对我来说,结果是这个库非常不稳定。

    【讨论】:

      猜你喜欢
      • 2012-01-19
      • 2018-08-20
      • 2013-11-09
      • 2018-02-23
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多