最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP對(duì)文件夾遞歸執(zhí)行chmod命令的方法

 更新時(shí)間:2015年06月19日 16:42:10   作者:不吃皮蛋  
這篇文章主要介紹了PHP對(duì)文件夾遞歸執(zhí)行chmod命令的方法,可實(shí)現(xiàn)遞歸執(zhí)行chmod命令改變文件夾執(zhí)行權(quán)限的功能,需要的朋友可以參考下

本文實(shí)例講述了PHP對(duì)文件夾遞歸執(zhí)行chmod命令的方法。分享給大家供大家參考。具體分析如下:

這里對(duì)文件夾和文件遞歸執(zhí)行chmod命令來改變執(zhí)行權(quán)限

<?php
  function recursiveChmod($path, $filePerm=0644, $dirPerm=0755)
  {
   // Check if the path exists
   if(!file_exists($path))
   {
     return(FALSE);
   }
   // See whether this is a file
   if(is_file($path))
   {
     // Chmod the file with our given filepermissions
     chmod($path, $filePerm);
   // If this is a directory...
   } elseif(is_dir($path)) {
     // Then get an array of the contents
     $foldersAndFiles = scandir($path);
     // Remove "." and ".." from the list
     $entries = array_slice($foldersAndFiles, 2);
     // Parse every result...
     foreach($entries as $entry)
     {
      // And call this function again recursively, with the same permissions
      recursiveChmod($path."/".$entry, $filePerm, $dirPerm);
     }
     // When we are done with the contents of the directory, we chmod the directory itself
     chmod($path, $dirPerm);
   }
   // Everything seemed to work out well, return TRUE
   return(TRUE);
  }
?>

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

武穴市| 海宁市| 富平县| 定襄县| 蒙阴县| 云梦县| 建始县| 沙洋县| 南丰县| 盐边县| 鹤庆县| 垦利县| 赣榆县| 揭东县| 吴江市| 大余县| 集安市| 甘洛县| 航空| 南投县| 庄河市| 章丘市| 江西省| 内黄县| 贺州市| 册亨县| 博爱县| 岳池县| 宁波市| 十堰市| 河西区| 沙洋县| 城口县| 英超| 高要市| 西贡区| 龙游县| 三亚市| 新津县| 五华县| 蒙城县|