thinkphp批量删除数据 --- 2018-05-25

//接收所有id

$consult_id['consult_id'] = input('post.id');

//遍历循环删除

foreach($consult_id as $id) {

    $app_time = Db::name('tbl_xlly_appointment_time')->delete($id);

    $con = Db::name('tbl_xlly_consultor')->delete($id);

    $cont = Db::name('tbl_xlly_consultor_time')->delete($id);

}

//判断是否删除成功

if($app_time || $con || $cont){

    $this->success('删除成功');

}else{

    $this->error('删除失败');

}

你可能感兴趣的:(thinkphp批量删除数据 --- 2018-05-25)