【发布时间】:2012-03-04 23:29:40
【问题描述】:
我想递归设置文件夹和文件权限。文件夹应该有 750 和文件 644。我找到了this 并做了一些修改。这个有用吗?
<?php
function chmod_r($Path) {
$dp = opendir($Path);
while($File = readdir($dp)) {
if($File != "." AND $File != "..") {
if(is_dir($File)){
chmod($File, 0750);
}else{
chmod($Path."/".$File, 0644);
if(is_dir($Path."/".$File)) {
chmod_r($Path."/".$File);
}
}
}
}
closedir($dp);
}
?>
【问题讨论】:
标签: php permissions chmod