CakeFest 2024: The Official CakePHP Conference

xattr_remove

(PECL xattr >= 0.9.0)

xattr_remove 拡張属性を削除する

説明

xattr_remove(string $filename, string $name, int $flags = 0): bool

この関数は、ファイルの拡張属性を削除します。

拡張属性には二種類の異なる名前空間、つまり、ユーザーとルートがあります。 ユーザー名前空間は、すべてのユーザーで利用可能ですが、ルート名前空間は、ルート権限を有するユーザーのみ利用可能です。 xattr はデフォルトでユーザー名前空間で処理を行いますが、 flags 引数によりこれを変更することができます。

パラメータ

filename

属性を削除するファイル。

name

削除する属性の名前。

flags

サポートされる xattr のフラグ
XATTR_DONTFOLLOW シンボリックリンクのリンク先をたどらず、リンクそのものを操作します。
XATTR_ROOT root (信頼された) 名前空間に属性を設定します。root 権限が必要です。

戻り値

成功した場合に true を、失敗した場合に false を返します。

例1 ファイルのすべての拡張属性を削除する

<?php
$file
= 'some_file';
$attributes = xattr_list($file);

foreach (
$attributes as $attr_name) {
xattr_remove($file, $attr_name);
}
?>

参考

add a note

User Contributed Notes

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