yii2 事务

$tt = Yii::$app->db->beginTransaction();//开启事务
try { //执行一系列数据库操作
  $tt->commit(); //没有报错就提交 } catch (Exception $e){   $tt->rollBack(); //报错回滚 }

  

posted @ 2018-07-13 10:04  百事可口  阅读(79)  评论(0编辑  收藏  举报