thinkphp5 中关于事务不能回滚问题
2023-03-29 23:03:03
83
{{single.collect_count}}

在项目开发中很多模块都会用到事务,但是在php中使用thinkphp5中事务不能回滚,解决办法

要注意三个地方,

1.MySQL数据库引擎为InnoDB 不能是MyISAM

请修改my.ini

default-storage-engine=INNODB

 2. thinkphp中不是使用

  db("test")

要使用

Db::name("test")

3. 检查MySQL中的表中使用的引擎是否为InnoDB

更改为

 

经过这三步操作,就可以实现thinkphp5 中事务回滚,希望对大家有用

 

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}