ZipArchive::setArchiveFlag
(PHP >= 8.3.0, PECL zip >= 1.22.0)
ZipArchive::setArchiveFlag — Set a global flag of a ZIP archive
Description
Set a global flag of a ZIP archive.
Parameters
flagThe global flag to change, among
AFL_*constants.valueThe new value of the flag.
Examples
Example #1 Create a torrentzip archive
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->setArchiveFlag(ZipArchive::AFL_WANT_TORRENTZIP, 1);
$zip->addFromString('test.txt', 'file content goes here');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>See Also
- ZipArchive::getArchiveFlag() - Returns the value of a Zip archive global flag
↑ and ↓ to navigate • Enter to select • Esc to close • / to open