<?php

//创建目录
function cmk($path=''){
//$path = 'test/test/mak';
$dir = explode('/',$path);
$dirs = array();
foreach($dir as $key => $val){
$dirs[] = $val;
$inpath = implode('/',$dirs);
if(!is_dir($inpath) && $inpath){
if(false == mkdir($inpath)){
return false;
}
}

return $path;
}
cmk();

//删除目录
function deldir($dir) {
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}

closedir($dh);

if(rmdir($dir)) {
return true;
} else {
return false;
}

?>