首页 > php函数 > PHP 获取文件目录权限函数fileperms介绍

PHP 获取文件目录权限函数fileperms介绍

在php中要获取或目录权限我们可使用fileperms函数来获取,fileperms() 函数返回文件或目录的权限,。若成功,则返回文件的访问权限。若失败,则返回 false。

 

例子 1

 代码如下 复制代码
echo fileperms("test.txt");
?>

输出:

33206

例子2

 代码如下 复制代码

/*
 *
document.write(document.location) 返回字符串的子串
 * base_convert  在任意进制之间转换数字
 * fileperms  取得文件的权限
 */
// 获取权限
function getChmod($filepath){
    return substr(base_convert(@fileperms($filepath),10,8),-4);
}


本文地址:http://www.phprm.com/function/php1004355.html

转载随意,但请附上文章地址:-)

标签:none

发表留言