正 文

php删除文件夹及其文件夹下所有文件


www.7dspace.com  更新日期:2005-8-17 3:34:53  七度空间


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;
  }
}

上一篇:php+odbc+access数据库操作函数
下一篇:php用流方式制作缩略图
作者:  来源:CSDN ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐