function delsvndir($svndir) { /** 先删除目录下的文件: */ $dh = opendir($svndir); while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fullpath = $svndir . "/" . $file; echo $fullpath . '<br>'; if (is_dir($fullpath)) { delsvndir($fullpath); } else { unlink($fullpath) or die("Cannot delete file."); } } } closedir($dh); /** 删除目录文件夹 */ if (rmdir($svndir)) { return true; } else { return false; } }
function delsvndir($svndir) { //先删除目录下的文件: $dh = opendir($svndir); while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fullpath = $svndir . "/" . $file; if (is_dir($fullpath)) { delsvndir($fullpath); } else { unlink($fullpath); } } } closedir($dh); //删除目录文件夹 if (rmdir($svndir)) { return true; } else { return false; } }
$db->query($sql); admin_log(addslashes($_REQUEST["name"]), 'update', 'album_type'); make_json_result("修改“" . $id . "," . $_REQUEST["name"] . "”成功!"); } } elseif ($_REQUEST['act'] == 'ajax_delete') { $id = !empty($_REQUEST['atype_id']) ? intval($_REQUEST['atype_id']) : 0; //如果做了考试安排,则不能删除 $sql = "select count(1) from " . $ecs->table("album") . " where type=" . $id; if ($db->getOne($sql)) { make_json_error("“" . get_album_type_name($id) . "”在图片管理中已使用,不能直接删除!"); exit; } //删除文件夹 $dirname = '../resource/data/album/' . $id; if (file_exists($dirname)) { delsvndir($dirname); } $sql = "delete from " . $ecs->table("album_type") . " where atype_id=" . $id; $db->query($sql); admin_log($_REQUEST["atype_id"], 'delete', 'album_type'); make_json_result("删除成功!"); } /** * 返回班级管理员列表数据 * * @access public * @param * * @return void */ function album_type_list()