function _createDir($htmlDirPath=''){
if (!is_dir($htmlDirPath)){
$temp = explode('/',$htmlDirPath);
$cur_dir = '';
for($i = 0;$i < count($temp);$i++){
$cur_dir .= $temp[$i].'/';
if (!is_dir($cur_dir)){
@mkdir($cur_dir,0777);
}
}
}
}

解决方案 »

  1.   

    function createFolder($path) {
      $t = split('/', $path);
      for($i=1; $i<count($t); $i++) {
        $p = join('/', array_slice($t, 0, $i+1);
        if(! file_exists($p)) {
          mkdir($p, 0777);
        }else {
          die('无法建立'.$p);
        }
      }
    }
      

  2.   

    function createDir($path = '')
    {
       if(!strlen($path))die('路径不可为空');   $num = count($temp = explode('/',$path));   while($temp)
       {
          $dir .= $temp[0] . '/';
          if(!@file_exists($dir))
          {
            if(!@mkdir($temp[0],0777))die('无法创建目录' . $temp[0]);
          }
          $temp = @array_shift($temp);
       }//End While}//End Function
      

  3.   

    上面写错了
    12行应该是 mkdir($dir,0777)