From 65c175913857879ca22e4966b306ac490ae33304 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 10 Apr 2013 15:48:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Think/Db/Driver/Mysql.php | 14 +++++++------- Think/Model.php | 12 ++++++------ start.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Think/Db/Driver/Mysql.php b/Think/Db/Driver/Mysql.php index 7fdcea6d..79279b8e 100644 --- a/Think/Db/Driver/Mysql.php +++ b/Think/Db/Driver/Mysql.php @@ -29,13 +29,13 @@ class Mysql extends Driver{ $info = []; if($result) { foreach ($result as $key => $val) { - $info[$val['Field']] = array( - 'name' => $val['Field'], - 'type' => $val['Type'], - 'notnull' => (bool) ($val['Null'] === ''), // not null is empty, null is yes - 'default' => $val['Default'], - 'primary' => (strtolower($val['Key']) == 'pri'), - 'autoinc' => (strtolower($val['Extra']) == 'auto_increment'), + $info[$val['field']] = array( + 'name' => $val['field'], + 'type' => $val['type'], + 'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes + 'default' => $val['default'], + 'primary' => (strtolower($val['key']) == 'pri'), + 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), ); } } diff --git a/Think/Model.php b/Think/Model.php index 32160383..bdc2dd19 100644 --- a/Think/Model.php +++ b/Think/Model.php @@ -231,7 +231,7 @@ class Model { } } // 分析表达式 - $options = $this->_parseOptions(); + $options = $this->_parseOptions();dump($this->fields); // 数据处理 $data = $this->_facade($data); if(false === $this->_before_insert($data,$options)) { @@ -927,9 +927,9 @@ class Model { */ public function getDbFields(){ if($this->fields) { - $fields = $this->fields; + $fields = $this->fields; unset($fields['_pk'],$fields['_type']); - return array_keys($fields); + return $fields; }else{ $fields = Cache::get(md5($this->getTableName())); if(!$fields) { @@ -946,9 +946,9 @@ class Model { Cache::set(md5($this->trueTableName),$fields); } if($fields) { - $this->fields = $fields; - // 永久缓存 - unset($fields['_pk'],$fields['_type']); + $this->fields = array_keys($fields); + $this->fields['_pk'] = $fields['_pk']; + $this->fields['_type'] = $fields['_type']; return array_keys($fields); } return false; diff --git a/start.php b/start.php index 9a1aff30..d2255afa 100644 --- a/start.php +++ b/start.php @@ -40,7 +40,7 @@ Config::load(THINK_PATH.'convention.php'); Log::init(['type'=>Config::get('log_type'),'log_path'=> Config::get('log_path')]); // 缓存初始化 -//Cache::connect(['type'=>Config::get('cache_type'),'temp'=> CACHE_PATH]); +Cache::connect(['type'=>'File','temp'=> CACHE_PATH]); // 注册行为扩展 //Tag::add('content_filter','ContentReplace','Think');