[PHP] TP8事务

54 阅读1分钟
Db::startTrans();
try {
    
    if (! $res) {
        throw new \Exception("添加卡失败:" . $sim_id);
    }
    
    // 提交事务
    Db::commit();
} catch (\Exception $e) {
    // 回滚事务
    Db::rollback();
}