(PECL xattr >= 0.9.0)
xattr_remove — 移除延伸屬性
此函式會移除檔案的延伸屬性。
延伸屬性有兩個不同的命名空間:user 和 root。所有使用者都可以使用 user 命名空間,而 root 命名空間僅供具有 root 權限的使用者使用。 xattr 預設操作 user 命名空間,但可以使用 flags
參數更改。
filename
要移除屬性的檔案。
name
要移除的屬性名稱。
flags
XATTR_DONTFOLLOW |
不要追蹤符號連結,而是對符號連結本身進行操作。 |
XATTR_ROOT |
在 root(受信任)命名空間中設定屬性。需要 root 權限。 |
範例 #1 移除檔案的所有延伸屬性
<?php
$file = 'some_file';
$attributes = xattr_list($file);
foreach ($attributes as $attr_name) {
xattr_remove($file, $attr_name);
}
?>