PHP fileperms () function
Definition and Usage
fileperms () function returns the file or directory permissions.
If successful, the function returns the rights to digital form. If it fails, it returns FALSE.
grammar
fileperms(filename)
参数 | 描述 |
---|---|
filename | 必需。规定要检查的文件。 |
Tips and Notes
Note: The results of this function are cached.Use clearstatcache () to clear the cache.
Example 1
<?php
echo fileperms("test.txt");
?>
echo fileperms("test.txt");
?>
The code above will output:
33206
Example 2
Octal value display permissions:
<?php
echo substr(sprintf("%o",fileperms("test.txt")),-4);
?>
echo substr(sprintf("%o",fileperms("test.txt")),-4);
?>
The code above will output:
1777
Complete PHP Filesystem Reference Manual