Statement on glibc/iconv Vulnerability

ZipArchive::setArchiveFlag

(PHP >= 8.3.0, PECL zip >= 1.22.0)

ZipArchive::setArchiveFlag设置 ZIP 归档的全局 flag

说明

public ZipArchive::setArchiveFlag(int $flag, int $value): bool

设置 ZIP 归档的全局 flag。

参数

flag

要改变的全局 flag,包含 AFL_* 常量。

value

flag 的新值。

返回值

成功时返回 true, 或者在失败时返回 false

示例

示例 #1 创建 torrentzip 归档

<?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';
}
?>

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top