PHP fileperms() 函數

定義和用法
fileperms() 函數返回檔或目錄的許可權。
如果成功,該函數以數字形式返回許可權。如果失敗,則返回 FALSE。
語法
fileperms(filename)
參數 | 描述 |
---|---|
filename | 必需。規定要檢查的檔。 |
提示和注釋
注釋:該函數的結果會被緩存。請使用 clearstatcache() 來清除緩存。
實例 1
<?php
echo fileperms("test.txt");
?>
echo fileperms("test.txt");
?>
上面的代碼將輸出:
33206
實例 2
以八進制值顯示許可權:
<?php
echo substr(sprintf("%o",fileperms("test.txt")),-4);
?>
echo substr(sprintf("%o",fileperms("test.txt")),-4);
?>
上面的代碼將輸出:
1777
