using zipArchive addFile() will not add image to zip
问题 I've been at this for a while. This actually worked one time, then never again. it simply does not create the zip file. The file does exist. $zip = new ZipArchive(); $filename = "./test" . time() .".zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) { exit("cannot open <$filename>\n"); } $thisdir = "$_SERVER[DOCUMENT_ROOT]/zip"; $zip->addFile($thisdir . "/trash-icon.png", "/gabage.png"); echo "numfiles: " . $zip->numFiles . "\n"; echo "status:" . $zip->status . "\n"; $zip->close();