Back to index

php5  5.3.10
create.php
Go to the documentation of this file.
00001 <?php
00002 error_reporting(E_ALL);
00003 if (!extension_loaded('zip')) {
00004     dl('zip.so');
00005 }
00006 $thisdir = dirname(__FILE__);
00007 unlink("./test112.zip");
00008 $zip = new ZipArchive();
00009 $filename = "./test112.zip";
00010 
00011 if (!$zip->open($filename, ZIPARCHIVE::CREATE)) {
00012        exit("cannot open <$filename>\n");
00013 } else {
00014        echo "file <$filename> OK\n";
00015 }
00016 
00017 $zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n");
00018 $zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n");
00019 $zip->addFile($thisdir . "/too.php","/testfromfile.php");
00020 echo "numfiles: " . $zip->numFiles . "\n";
00021 echo "status:" . $zip->status . "\n";
00022 $zip->close();
00023 unset($zip);