try{
M()->execute('begin');
if (M('role_user')->where(array('user_id'=>$er_info['er_user_id']))->save(array('role_id'=>2))===false) {
throw new \Exception("激活账户失败,请稍后重试");
};
M()->execute('commit');
var_dump('激活成功');
}catch(\Exception $e){
M()->execute('rollback');
die($e->getMessage());
}
thinkphp3.2.2try catch和mysql事务
最新推荐文章于 2022-01-14 11:07:56 发布