try{
‘数据库操作’;
Db::commit();
$this->success(“成功”)
}cathe(\Exception $exception){
Db::rollback();
$this->error(“成功”);
}
$this->success();其实也是会抛出异常
解决方法:
将:
catch (\Exception $exception)
改为
catch (\think\Exception\DbException $exception)