【问题标题】:ZipArchive is not working in sever but working in localhostZipArchive 不在服务器中工作,但在 localhost 中工作
【发布时间】:2020-08-05 17:00:21
【问题描述】:

以下代码在本地主机中运行,但在服务器中不运行。

$zip = new ZipArchive();
$zip_name = $_POST['zip_category_name'] . $student_id . ".zip";
$zip->open($zip_name, ZipArchive::CREATE);
$res = $academicObj->get_files_by_category($_POST['download_files_zip']);
while ($row = mysqli_fetch_array($res)) {
    if (file_exists($row['path'] . $row['file'])) {
        $zip->addFromString(basename($row['doc_name']), file_get_contents($row['path'] . $row['file']));
    }
}
if ($zip->numFiles > 0) {
    echo $zip_name;
}
$zip->close(); 

写权限没有问题 我的服务器 PHP 版本是 7.2.32。请帮忙....

【问题讨论】:

  • 错误信息是什么?
  • 没有显示任何错误
  • 如果在直接输出中看不到错误,请尝试查看 apache 错误日志。

标签: php php-zip-archive


【解决方案1】:

缺少 zip 存档插件。我通过使用 calss_exist() 函数检查找到了它。感谢您的帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-13
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    相关资源
    最近更新 更多