Db::startTrans(); //啓動事務 try { 這裏寫SQL語句 Db::commit(); //提交事務 } catch (\PDOException $e) { Db::rollback(); //回滾事務 }