## 批量删除回收站的内容 1.View: 添加批量删除按钮,并指定删除方法 > \themes\admin_simpleboot3\admin\recycle_bin\index.html <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('RecycleBin/deleteAll')}" data-subcheck="true" data-msg="您确定删除选中的数据吗?"> 批量{:lang('DELETE')} </button> 2. Controller: 新增 deleteAll() > \vendor\thinkcmf\cmf-app\src\admin\controller\RecycleBinController.php public function deleteAll() { $param = $this->request->param(); if (isset($param['ids'])) { $ids = $this->request->param('ids/a'); //通过ids查询出清除的结果集 $result = Db::name('recycleBin')->where('id', 'in', $ids)->select(); if ($result) { //遍历得出文章IDS foreach ($result as $key => $value) { $wzids[]=$value['object_id']; } //文章表 删除相关文章 $re = Db::name('portal_post')->where('id', 'in', $wzids)->delete(); if ($re) { //关系表 删除相关文章ID Db::name('portal_category_post')->where('post_id', 'in', $wzids)->delete(); //标签表 删除相关文章ID Db::name('portal_tag_post')->where('post_id', 'in', $wzids)->delete(); //回收站表 删除相关ID $res = Db::name('recycleBin')->where('id', 'in', $ids)->delete(); if ($res) { $this->success("删除成功!"); } } } } }