xattr_set() 函數可以設置擴展屬性。
用法
bool xattr_set( string $filename , string $name , string $value [, int $flags ] )
xattr_set() 函數可以設置文件擴展屬性的值。
擴展屬性有兩個不同的命名空間:user 和 root。用戶命名空間可供所有用戶使用,而根命名空間僅適用於具有 root 權限的用戶。默認情況下,xattr 可以對用戶命名空間進行操作,但我們可以使用 flags 參數更改它。
xattr_set() 函數可以在成功時返回 true 或在失敗時返回 false。
示例
<?php
$file = "my_favourite_song.wav";
xattr_set($file, "Artist", "Someone");
xattr_set($file, "My ranking", "Good");
xattr_set($file, "Listen count", "34");
printf("You've played this song %d times", xattr_get($file, "Listen count"));
?>
相關用法
- PHP xattr_supported()用法及代碼示例
- PHP xattr_list()用法及代碼示例
- PHP xattr_remove()用法及代碼示例
- PHP xattr_get()用法及代碼示例
- PHP xmlwriter_end_dtd_attlist()用法及代碼示例
- PHP xmlwriter_end_dtd_element()用法及代碼示例
- PHP xdiff_file_diff_binary()用法及代碼示例
- PHP xml_get_current_column_number()用法及代碼示例
- PHP xmlwriter_write_dtd()用法及代碼示例
- PHP xdiff_file_rabdiff()用法及代碼示例
- PHP xmlwriter_full_end_element()用法及代碼示例
- PHP xmlwriter_end_document()用法及代碼示例
- PHP xmlwriter_end_comment()用法及代碼示例
- PHP xmlwriter_start_cdata()用法及代碼示例
- PHP xmlwriter_end_element()用法及代碼示例
- PHP xdiff_string_rabdiff()用法及代碼示例
- PHP xml_parser_free()用法及代碼示例
- PHP xmlwriter_end_dtd()用法及代碼示例
- PHP xml_get_current_byte_index()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - xattr set() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。