From bd930b397e7f36ad95bfa47fe43a3da3438b3470 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 23 Nov 2015 12:21:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bgetdbfields=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/think/model.php b/library/think/model.php index e5a0a9cb..cb84a0da 100644 --- a/library/think/model.php +++ b/library/think/model.php @@ -881,9 +881,10 @@ class Model unset($fields['_pk'], $fields['_type']); return $fields; } else { - $fields = Cache::get(md5($this->getTableName())); + $tableName = $this->getTableName(); + $fields = Cache::get(md5($tableName)); if (!$fields) { - $fields = $this->db->getFields($this->getTableName()); + $fields = $this->db->getFields($tableName); $this->fields = array_keys($fields); foreach ($fields as $key => $val) { // 记录字段类型 @@ -905,7 +906,7 @@ class Model } // 记录字段类型信息 $this->fields['_type'] = $type; - Cache::set(md5($this->trueTableName), $this->fields); + Cache::set(md5($tableName), $this->fields); $fields = $this->fields; } else { $this->fields = $fields;