douping7975 2015-05-19 14:24
浏览 64
已采纳

尽管检查,路径名是正确的,但创建zip和zip-> close()会返回false

I've been trying to create a Zip file using PHP and the ZipArchive, but despite checking that each file I add is readable, writable, and exists, zip->close() returns false. If I call zip->numFiles, it returns the number I suspect, but file_exists($zipname) still returns false. Immediately after adding a file, $zip->getStatusString() returns "No Error". If I call $zip->getStatusString() right after calling zip->close() it returns "Failure to create temporary file: Permission denied".

I've checked this link Zip->close() returns false despite checks, and have ensured that the $file I'm making checks for is the exact same as the $file I'm adding to the $zip.

Is there something I'm overlooking?

  • 写回答

1条回答 默认 最新

  • dousha1873 2015-05-19 15:16
    关注

    From the comments, so this question does have an answer:

    Whilst the files might be readable and writable, the location the zip archive is being written to also needs to be writable by the web server.

    The number of files in the zip archive count are being counted because the zip stream is in memory at that stage, and not on disk.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器