欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

thinkphp,事务回滚解决办法

程序员文章站 2022-05-26 15:28:33
...
thinkphp,事务回滚
function test(){
$withdraw = M('Withdraw');
$withdraw->startTrans();

$data['agent_id']=1;
$data['money']=1222;

$withdraw->add($data);

$withdraw->rollback();
}

------解决方案--------------------
你那数据应该没插进去吧,$withdraw->rollback();回滚了
------解决方案--------------------
$withdraw->startTrans();
$withdraw = M('Withdraw');
$withdraw->add($data);
if(成功){
$withdraw->commit();
}else{
$withdraw->rollback();
}

////////////////////////////////////
thinkphp,事务回滚解决办法

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频