php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
create.php
Go to the documentation of this file.
1<?php
3if (!extension_loaded('zip')) {
4 dl('zip.so');
5}
6$thisdir = dirname(__FILE__);
7unlink("./test112.zip");
9$filename = "./test112.zip";
10
11if (!$zip->open($filename, ZIPARCHIVE::CREATE)) {
12 exit("cannot open <$filename>\n");
13} else {
14 echo "file <$filename> OK\n";
15}
16
17$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n");
18$zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n");
19$zip->addFile($thisdir . "/too.php","/testfromfile.php");
20echo "numfiles: " . $zip->numFiles . "\n";
21echo "status:" . $zip->status . "\n";
22$zip->close();
23unset($zip);
unlink(string $filename, $context=null)
dirname(string $path, int $levels=1)
$filename
Definition create.php:9
if(!extension_loaded('zip')) $thisdir
Definition create.php:6
$zip
Definition create.php:8
dl(string $extension_filename)
Definition dl.stub.php:3
time()
error_reporting(?int $error_level=null)
exit(string|int $status=0)
extension_loaded(string $extension)
#define E_ALL
Definition zend_errors.h:43