Php ziparchive打开方法不工作

Php ziparchive打开方法不工作,php,zip,wampserver,ziparchive,Php,Zip,Wampserver,Ziparchive,我正在使用我创建的函数从包含文件的数组创建一个zip文件 function create_zip($files = array(),$destination = '',$overwrite = false) { //if the zip file already exists and overwrite is false, return false if(file_exists($destination) && !$overwrite) { return false; }

我正在使用我创建的函数从包含文件的数组创建一个zip文件

function create_zip($files = array(),$destination = '',$overwrite = false) {
//if the zip file already exists and overwrite is false, return false
if(file_exists($destination) && !$overwrite) { return false; }
    //create the archive
    $zip = new ZipArchive();
    if($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true)    {
            return false;
    }
    //add the files
    foreach($files as $file) {
            $zip->addFile($file);
    }
    //debug
    echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;

    //close the zip -- done!
    $zip->close();

    //check to make sure the file exists
    return file_exists($destination);
}
但是,当我将它与适当的文件数组一起使用时(当我在创建zip之前在同一路径中创建目录时,目标路径是可写的),它会返回 'zip存档包含4个状态为0的文件' 当我在提交过程中检查文件夹时,我看到一个名为fileName.zip.0156a的文件,它在几秒钟内被删除
当我试图得到$zip->open的响应时,它返回1

这段代码没有什么奇怪的。顺便问一下,为什么您的邮政编码命名为
fileName.zip.0156a
(.zip后面的.0156a)。编辑:你没有一个函数来清理你的目录?如何清理它我不知道为什么扩展名被添加到文件中,我想它的临时文件?哦。不需要吗?请打印您的
$destination
。C:\wamp\www\cms\uploads\passwords\56\u password.zip