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