事务

在model层写事务:

tp 5.0框架

注意点:

1.使用model插入数据时,要使用对应的调用方法

$this->startTrans();

$this->rollback();
$this->commit();
2.使用DB操作数据库时
Db::startTrans();
Db::rollback();
Db::commit();
posted @ 2023-03-14 17:03  萌妹子的vlog  阅读(20)  评论(0)    收藏  举报