From e16cb705ba9579364fee20e693ecf71848c656b0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 21 Feb 2016 11:37:28 +0800 Subject: [PATCH] =?UTF-8?q?model=E7=B1=BB=E7=9A=84setField=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=BF=BD=E7=95=A5=E6=95=B0=E6=8D=AE=E5=89=AF=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- library/think/View.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 8babc324..2d04dd35 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -680,6 +680,8 @@ class Model } else { $data[$field] = $value; } + // 更新某个字段的时候 忽略数据副本 + $this->duplicate = []; return $this->save($data); } @@ -709,7 +711,6 @@ class Model $step = '-' . $step; } } - $this->duplicate = []; return $this->setField($field, ['exp', $field . '+' . $step]); } @@ -739,7 +740,6 @@ class Model $step = '-' . $step; } } - $this->duplicate = []; return $this->setField($field, ['exp', $field . '-' . $step]); } diff --git a/library/think/View.php b/library/think/View.php index ce9c9967..7489b6a9 100644 --- a/library/think/View.php +++ b/library/think/View.php @@ -145,13 +145,13 @@ class View * * @param string $template 模板文件名或者内容 * @param array $vars 模板输出变量 - * @param array $cache 模板缓存参数 + * @param array $config 模板参数 * @param bool $renderContent 是否渲染内容 * * @return string * @throws Exception */ - public function fetch($template = '', $vars = [], $cache = [], $renderContent = false) + public function fetch($template = '', $vars = [], $config = [], $renderContent = false) { // 模板变量 $vars = $vars ? $vars : $this->data; @@ -175,7 +175,7 @@ class View is_file($template) ? include $template : eval('?>' . $template); } else { // 指定模板引擎 - $this->engine->fetch($template, $vars, $cache); + $this->engine->fetch($template, $vars, $config); } // 获取并清空缓存 $content = ob_get_clean();