xattr_list
(PECL)
xattr_list --
Get a list of extended attributes
説明
array
xattr_list ( string filename [, int flags] )
This functions gets a list of names of extended attributes of a file.
拡張属性には二種類の異なる名前空間、つまり、ユーザとルートがあります。
ユーザ名前空間は、全てのユーザで利用可能ですが、ルート名前空間は、ルート権限を有するユーザのみ利用可能です。
xattrはデフォルトでユーザ名前空間で処理を行いますが、 flags 引数によりこれを変更することができます。
パラメータ
- filename
The path of the file.
- flags
表 1. Supported xattr flags
XATTR_DONTFOLLOW | Do not follow the symbolic link but operate on symbolic link itself. |
XATTR_ROOT | Set attribute in root (trusted) namespace. Requires root privileges. |
戻り値
This function returns an array with names of extended attributes.
例
例 1. Prints names of all extended attributes of file
<?php $file = 'some_file'; $root_attributes = xattr_list($file, XATTR_ROOT); $user_attributes = xattr_list($file);
echo "Root attributes: \n"; foreach ($root_attributes as $attr_name) { printf("%s\n", $attr_name); }
echo "\n User attributes: \n"; foreach ($attributes as $attr_name) { printf("%s\n", $attr_name); }
?>
|
|