我没有把一个文件放到一个新的zip存档中.
@H_301_10@makeZipTest.PHP:
<?PHP $destination = __DIR__.'/makeZipTest.zip'; $fileToZip = __DIR__.'/hello.txt'; $zip = new ZipArchive(); if (true !== $zip->open($destination,ZIPARCHIVE::OVERWRITE)) { die("Problem opening zip $destination"); } if (!$zip->addFile($fileToZip)) { die("Could not add file $fileToZip"); } echo "numfiles: " . $zip->numFiles . "\n"; echo "status: " . $zip->status . "\n"; $zip->close();
zip已创建,但为空.然而,没有触发任何错误.
出了什么问题?