年年我发



返回   年年我发 > 网站建设 > 代码交流
用户名
密码
 
注册账号 论坛帮助 会员列表 日历事件网赚工具 标记版面已读

代码交流 ASP,PHP,JSP等网站源代码下载与交流。

回复
 
主题工具 搜索本主题 显示模式
  #1   IP: 59.60.147.227
旧 2008-04-02, 01:27 PM
car car 当前离线
高级会员
 
注册日期: 2006-05-14
帖子: 434
精华: 0
现金: 4649 元
资产: 4649 元
声望: 10 car 正向着好的方向发展
默认 php删除一个目录下的所有文件

php删除一个目录下的所有文件
代码:
<? //删除目录 //本程序由wm_chief原创,如要转载,请注明作者与来源(http://www.phome.net) class del_path { function wm_chief_delpath($del_path) { if(!file_exists($del_path))//目标目录不存在则建立 {echo"目录不存在";return false;} $hand=opendir($del_path); $i=0; while($file=readdir($hand)) {$i++; if($i==1||$i==2) {continue;} if(!(strchr($file,"."))) { $del_s_path=$del_path."/".$file; $this->wm_chief_delpath($del_s_path); } else { $del_file=$del_path."/".$file; $this->wm_chief_file($del_file); } } closedir($hand); $this->wm_chief_path($del_path); return true; } //删除文件 function wm_chief_file($del_file) { unlink($del_file); } //删除目录 function wm_chief_path($del_path) { rmdir($del_path); } } $DelPath="../wwwroot";//要删除的目录 $wm_chief=new del_path(); $wm_chief_ok=$wm_chief->wm_chief_delpath($DelPath); if($wm_chief_ok) { echo"删除完毕"; } //本程序由wm_chief原创,如要转载,请注明作者与来源(http://www.phome.net)
回复时引用此帖

wellcome to www.0058.net
回复


当前查看此主题的会员: 1 (0 位会员和 1 位游客)
 
主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

论坛启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
论坛跳转


所有时间均为北京时间. 现在的时间是 07:13 PM, Free Patent & Patent Ideas


Powered by vBulletin 3.5.2 Chinese Exhibition Happy New Year
©2000 - 2008,Jelsoft Enterprises Ltd  Desiccant Molecular Sieve Weight Loss Bentonite Trade Manager