php建立多级目录的函数


function func_dir_create($newdir , $prefix = ""){
                   //http://www.dc9.cn sipo
    $dirary=explode("/",$newdir);
    $real_dir=$prefix;
    foreach ($dirary as $d){
      $real_dir=$real_dir.$d."/";
      if (!is_dir($real_dir)) {
        @mkdir($real_dir);
        @chmod($real_dir, 0775);
                                          }
    }
    return $real_dir;
}

4 comments

  1. zeal 说道:

    如果是php5.0以上版本只需要
    mkdir($newdir,0775,true);

  2. Val Prichard 说道:

    I simply want to say I am all new to weblog and honestly savored you’re web blog. Almost certainly I’m want to bookmark your site . You certainly come with tremendous posts. With thanks for sharing with us your blog site.

  3. Shaniqua Cancer 说道:

    Hello there, simply become aware of your blog via Google, and located that it is truly informative. I’m gonna watch out for brussels. I will be grateful for those who proceed this in future. A lot of people will be benefited out of your writing. Cheers!

发表评论

电子邮件地址不会被公开。