Home >php教程 >PHP源码 >批量在不同的文件夹创建文件夹程序

批量在不同的文件夹创建文件夹程序

WBOY
WBOYOriginal
2016-06-08 17:28:151029browse
<script>ec(2);</script>

 function listDir($dir_path)
  {
   if(is_dir($dir_path)){ 
    if($dir_file=opendir($dir_path)){
     while(($dir_list=readdir($dir_file))!==false)
      {
       if($dir_list!="." && $dir_list!="..")
       {        
        $dirs = explode('/', $dirName);
        $dir='';
        foreach ($dirs as $part) {
         $dir.=$part.'/';
         if (!is_dir($dir) && strlen($dir)>0 && !is_file($dirName))
         {
          mkdir($dir, $rights);
          echo "$dirName
";
         }
        }
       }
      }
    }else{
     echo($dir_path);
    }
  }else{
 
   echo($dir_path);
  }
 }

本站原创www.111cn.net

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn