diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /ext/zip/examples/create.php | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
Diffstat (limited to 'ext/zip/examples/create.php')
| -rw-r--r-- | ext/zip/examples/create.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/zip/examples/create.php b/ext/zip/examples/create.php new file mode 100644 index 000000000..cffacee93 --- /dev/null +++ b/ext/zip/examples/create.php @@ -0,0 +1,20 @@ +<?php +error_reporting(E_ALL); +$thisdir = dirname(__FILE__); +unlink("./test112.zip"); +$zip = new ZipArchive(); +$filename = "./test112.zip"; + +if (!$zip->open($filename, ZIPARCHIVE::CREATE)) { + exit("cannot open <$filename>\n"); +} else { + echo "file <$filename> OK\n"; +} + +$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n"); +$zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n"); +$zip->addFile($thisdir . "/too.php","/testfromfile.php"); +echo "numfiles: " . $zip->numFiles . "\n"; +echo "status:" . $zip->status . "\n"; +$zip->close(); +unset($zip); |
