萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> 一款php目錄無限級創建代碼

一款php目錄無限級創建代碼

*/
function makedirectory($directoryname) {
       $directoryname = str_replace("","/",$directoryname);
       $dirnames = explode('/', $directoryname);
       $total = count($dirnames) ;
       $temp = '';
       for($i=0; $i<$total; $i++) {
         $temp .= $dirnames[$i].'/';
         if (!is_dir($temp)) {
            $oldmask = umask(0);
            if (!mkdir($temp, 0777)) exit("不能建立目錄 $temp");
            umask($oldmask);
         }
       }
       return true;
}
copyright © 萬盛學電腦網 all rights reserved