From cc753a884e1547e87e7d3c95bec20b6cabbd2823 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Jan 2016 22:50:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E4=B8=BB=E9=94=AE?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 67079f43..b18926cc 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1120,7 +1120,7 @@ class Model { if ($this->fields) { $fields = $this->fields; - unset($fields['_type']); + unset($fields['_type'], $fields['_pk']); return $fields; } else { $tableName = $this->getTableName(); @@ -1144,12 +1144,14 @@ class Model } // 记录字段类型信息 $this->fields['_type'] = $type; + $this->fields['_pk'] = $this->pk; APP_DEBUG && Cache::set($guid, $this->fields); $fields = $this->fields; } else { $this->fields = $fields; + $this->pk = $fields['_pk']; } - unset($fields['_type']); + unset($fields['_type'], $fields['_pk']); return $fields; } }