The fileperms() function returns the permissions of a file or directory.
If successful, the function returns the permission as a number. If it fails, returns FALSE.
fileperms(filename)
| parameter | describe |
|---|---|
| filename | Required. Specifies the documents to be checked. |
Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.
<?phpecho fileperms("test.txt");?>The above code will output:
33206
Display permissions as octal values:
<?phpecho substr(sprintf("%o",fileperms("test.txt")),-4);?>The above code will output:
1777