https://static.06ms.com/static/images/index/4.jpg

php建立多级目录(多层目录)

//php建立多级目录(多层)I
mkpath('hml/a/b/c/d/e');
function mkpath($mkpath,$mode=0777){
$path_arr=explode('/',$mkpath);
foreach ($path_arr as $value){
if(!emptyempty($value)){
if(emptyempty($path))$path=$value;
else $path.='/'.$value;
is_dir($path) or mkdir($path,$mode);
}
}
if(is_dir($mkpath))return true;
return false;
}