php自动创建无限级文件夹【非递归】

      /**
       * 自动创建目录
       *   @param   string $destFolder 服务器路径
       *   @static
       */
         public static function   makeDir($destFolder)
      {
               if   (! is_dir($destFolder) && $destFolder !=   './'   && $destFolder !=   '../' )
            {
                  $dirname =   '' ;
                  $folders = explode(   '/' , $destFolder);
                     foreach   ($folders   as   $folder)
                  {
                        $dirname .= $folder .   '/' ;
                           if   ($folder !=   ''   && $folder !=   '.'   && $folder !=   '..'   && ! is_dir($dirname))
                        {
                              mkdir($dirname);
                        }
                  }
            
               // chmod($destFolder,0777);
            }
      }

123宝贝网(www.123baby.net)

你可能感兴趣的:(PHP常用封装类,无限级文件夹)