该fileperms()函数返回文件的权限。如果成功,它将以数字形式返回许可,否则,将返回FALSE。
fileperms(file_path)
file_path-要检查的文件的路径。
该fileperms()函数在成功时以数字形式返回许可,否则在失败时返回FALSE。
<?php
echo fileperms("new.txt");
?>输出结果
33206
让我们看另一个将权限显示为八进制值的示例。
<?php
echo substr(sprintf('%o', fileperms(two.txt')), -4);
?>输出结果
0666