php 递归删除目录

//删除目录
function delDir($path){
//glob 是遍历目录中的成员,返回数组
foreach(glob($path.'/*') as $f){
is_dir($f)?delDir($f):unlink($f);
}
//删除目录
rmdir($path);
}
delDir('demo');

posted @ 2017-11-26 23:11  globalfy  阅读(139)  评论(0编辑  收藏  举报