首页 > 其他 > 详细

级联删除的方法

时间:2015-05-16 13:08:48      阅读:142      评论:0      收藏:0      [点我收藏+]
1. exec("rd /s /q y12");命令删除目录
$path=‘y12/aa/bb/cd/ff/aa/ee/dd‘;
//mkdir($path,0777,true);
exec("rd /s /q y12");
技术分享
2.运用递归函数实现级联删除用时直接调用既可以
$path=‘y12/aa/bb/cd/ff/aa/ee/dd‘;
function delTree($dir) {
$files = array_diff(scandir($dir), array(‘.‘,‘..‘));
foreach ($files as $file) {
(is_dir("$dir/$file") && !is_link($dir)) ? delTree("$dir/$file") : unlink("$dir/$file");
}
return rmdir($dir);
}
delTree(‘y12‘);




级联删除的方法

原文:http://www.cnblogs.com/lsr111/p/4507607.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!