php怎么设置文件的权限-PHP问题

资源魔 31 0

php设置文件权限的办法是:

应用chmod函数
mode 参数蕴含三个八进制数按程序辨别指定了一切者、一切者所正在的组和一切人的拜访限度。每一一局部均可以经过退出所需的权限来较量争论出所要的权限。数字 1 示意使文件可执行,数字 2 示意使文件可写,数字 4 示意使文件可读。退出这些数字来制订所需求的权限。

<?php
// Read and write for owner, nothing for everybody else
chmod("/somedir/somefile", 0600);
// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);
// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);
// Everything for owner, read and execute for owner's group
chmod("/somedir/somefile", 0750);
?>

相干参考:资源魔

以上就是php怎样设置文件的权限的具体内容,更多请存眷资源魔其它相干文章!

标签: php php教程 php故障解决 php使用问题

抱歉,评论功能暂时关闭!