我已经有一段时间了.这实际上工作了一次,然后再也没有.它根本不会创建zip文件.该文件确实存在.
原文链接:/php/134565.html$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();
如果我添加类似的东西
$zip->addFromString("testfilePHP.txt","#1 This is a test string added as testfilePHP.txt.\n");