From f97626f6a23d32d900c06e76abb60bc950aa7296 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 10 Apr 2016 14:35:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Driver.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/library/think/db/Driver.php b/library/think/db/Driver.php index 1045c53f..5632ec38 100644 --- a/library/think/db/Driver.php +++ b/library/think/db/Driver.php @@ -372,16 +372,17 @@ abstract class Driver * @param callable $callback 数据操作方法回调 * @return void */ - public function transaction($callback){ + public function transaction($callback) + { $this->startTrans(); try { if (is_callable($callback)) { - call_user_func_array($callback, [$sql, $runtime, $explain]); - } - $this->commit(); - }catch (\PDOException $e) { - $this->rollback() - } + call_user_func_array($callback, []); + } + $this->commit(); + } catch (\PDOException $e) { + $this->rollback(); + } } /**