W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
(PHP 5 >= 5.6.0, PHP 7, PHP 8, PECL zip >= 1.12.4)
ZipArchive::getExternalAttributesIndex — 檢索由其索引定義的條目的外部屬性
public ZipArchive::getExternalAttributesIndex(
int $index,
int &$opsys,
int &$attr,
int $flags = 0
): bool
檢索由其索引定義的條目的外部屬性。
index
條目的索引。
opsys
成功后,接收由 ZipArchive::OPSYS_ 常量之一定義的操作系統(tǒng)代碼。
attr
成功后,接收外部屬性。值取決于操作系統(tǒng)。
flags
如果 flags 設(shè)置為 ZipArchive::FL_UNCHANGED
,則原始保持不變 返回屬性。
成功時返回 true, 或者在失敗時返回 false。
本示例提取 ZIP 的所有條目 archive 和 從外部屬性設(shè)置 Unix 權(quán)限。test.zip
示例 #1 提取所有具有 Unix 權(quán)限的條目
<?php
$zip = new ZipArchive();
if ($zip->open('test.zip') === TRUE) {
for ($idx=0 ; $s = $zip->statIndex($idx) ; $idx++) {
if ($zip->extractTo('.', $s['name'])) {
if ($zip->getExternalAttributesIndex($idx, $opsys, $attr)
&& $opsys==ZipArchive::OPSYS_UNIX) {
chmod($s['name'], ($attr >> 16) & 0777);
}
}
}
$zip->close();
echo "Ok\n";
} else {
echo "KO\n";
}
?>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: