attr_get,說明,參數,返回值,實例講解,
attr_get
xattr_get -- Get an extended attribute(得到一個擴展屬性)
說明
string xattr_get( string filename, string name [, int flags] )
This function gets the value of an extended attribute of a file.
擴展的屬性有兩個不同的名字空間:user 和 root 名字空間。user 名字空間對所有用戶均有效,而 root 名字空間僅對擁有 root 許可權的用戶有效。xattr 默認在 user 名字空間上進行操作,但是可以使用 flags參數進行更改。
參數
filename
The file from which we get the attribute.
name The name of the attribute.
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. |
返回值
Returns a string containing the value or FALSEif the attribute doesn't exist.
實例講解
]Checks if system administrator has signed the fileb] <?php
$file = '/usr/local/sbin/some_binary';
$signature = xattr_get($file, 'Root signature', XATTR_ROOT);
/* ... check if $signature is valid ... */
?>