tp5中使用事务

    function  shiwu(){
        $this->startTrans();
        // 进行相关的业务逻辑操作
        $data['video_status']=1;
        $video_id=$this->insertGetId($data); // 保存用户信息
        if (true){
            // 提交事务
            $this->commit();
            return $video_id; 
        }else{
            // 事务回滚
            $this->rollback(); 
        }
    }

猜你喜欢

转载自www.cnblogs.com/mengor/p/9004225.html