批量删除
程序员文章站
2022-05-31 16:34:02
...
delete from 表 where id in(1,2,3) #id为1,2,3的
delete from 表 where id not in(1,2,3) #除1,2,3之外的所有记录
delete from 表 where id between 1 and 5 #id为1-3的
delete from 表 where id not between 1 and 5 #除1-5之外的所有记录
tp5的批量删除
$arr = $_POST['id_array'];
//获取前台ajax 传过来的数据 通过where条件删除多id
$data=Db::table("plan")->where('id','in',$arr)->delete();
if($data){
return json(1);
}else{
return json(0);
}
推荐阅读