From d381c51892faf2a5e16b346e92cc3be78fd04bb0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 1 Feb 2016 12:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BD=93=E4=BD=BF=E7=94=A8ta?= =?UTF-8?q?ble=E6=96=B9=E6=B3=95=E7=9A=84=E6=97=B6=E5=80=99=20getPk?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index 6c06e4ac..f3c8e466 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1102,7 +1102,8 @@ class Model public function getPk() { if (is_null($this->pk)) { - $this->pk = $this->getTableInfo('', 'pk'); + $tableName = isset($this->options['table']) ? $this->options['table'] : $this->getTableName(); + $this->pk = $this->getTableInfo($tableName, 'pk'); } return $this->pk; }