thinkphp5不能回滚

浏览:1184 发布日期:2017/02/10 分类:ThinkPHP5专区 关键字: thinkphp5
public function gun(){

        Db::startTrans();
        try{
            $where['id']=1;
            $data1['a1']=5;
            Db::table('qgs_a1')->where($where)->update($data1);
            exception('异常消息', 100006);
            $where2['id']=1;
            $data2['a2']=5;
            Db::table('qgs_a2')->where($where2)->update($data2);
            Db::commit();
        } catch (\Exception $e) {
            echo "ccc";
            // 回滚事务
            Db::rollback();
        }

    }
无法回滚,qgs_a1里面的a1还是等于5
最佳答案
评论( 相关
后面还有条评论,点击查看>>