首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ZipArchive::setExternalAttributesName

(PHP 5 >= 5.6.0, PHP 7, PECL zip >= 1.12.4)

ZipArchive::setExternalAttributesName - 设置由其名称定义的条目的外部属性

描述

代码语言:javascript
复制
bool ZipArchive::setExternalAttributesName ( string $name , int $opsys , int $attr [, int $flags ] )

设置由其名称定义的条目的外部属性。

参数

name

条目的名称。

opsys

操作系统代码由ZipArchive::OPSYS_常数之一定义。

attr

外部属性。价值取决于操作系统。

flags

可选标志。目前尚未使用。

返回值

成功时返回TRUE或失败时返回FALSE

示例

这个例子打开一个ZIP文件存档test.zip并添加文件test.txt作为外部属性的Unix权限。

Example #1 Archive a file, with its Unix rights

代码语言:javascript
复制
<?php
$zip?=?new?ZipArchive();
$stat?=?stat($filename='test.txt');
if?(is_array($stat)?&&?$zip->open('test.zip',?ZipArchive::CREATE)?===?TRUE)?{
????$zip->addFile($filename);
????$zip->setExternalAttributesName($filename,?ZipArchive::OPSYS_UNIX,?$stat['mode']?<<?16);
????$zip->close();
????echo?"Ok\n";
}?else?{
????echo?"KO\n";
}
?>

← ZipArchive::setExternalAttributesIndex

ZipArchive::setPassword →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com