1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?php
$zip = new ZipArchive();
$filename = "./test112.zip";
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
exit("cannot open <$filename>\n");
}
$zip->addFromString("testfilephp.txt" . time(), "#1 Ceci est un test, ajouté en tant que fichier testfilephp.txt.\n");
$zip->addFromString("testfilephp2.txt" . time(), "#2 Ceci est un test, ajouté en tant que fichier testfilephp2.txt.\n");
$zip->addFile($thisdir . "/too.php","/testfromfile.php");
echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->status . "\n";
$zip->close();
?> |
Partager