php fileperms函数介绍

fileperms() 函数返回文件或目录的权限,如果成功,该函数以数字形式返回权限,如果失败,则返回 FALSE。该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。

语法:

int fileperms  ( string $filename  )

取得文件的权限。 

参数:

  1. filename  文件的路径。 

 

php fileperms函数实例

1.使用fileperms函数获取文件manongjc.txt的权限:

<?php
/*  http://www.manongjc.com/article/1413.html */
echo fileperms(\"manongjc.txt\");
?>

运行结果:

33206

2.获取8进制的权限

<?php
   echo substr( _convert(fileperms(\"/etc/passwd\"), 10, 8), 3);
?>
收藏 打印