thinkphp5.0模型事务批量处理数据

自己写的,完全没问题

<?php
$data = [
    0=>[
   //id为主键
'id'=>1, 'type'=>3 ], 1=>[ 'id'=>2, 'type'=>3 ] ]; $OrderModel = new OrderModel(); $OrderModel->startTrans(); try{ $OrderModel->allowField(true)->isUpdate(true)->saveAll($data); }catch (Exception $e){ $OrderModel->rollback(); return; } OrderModel->commit();
原文地址:https://www.cnblogs.com/wenhainan/p/12893757.html