From 2a09d8d8db6312cd22997b8652191874534368c7 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Apr 2016 10:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/View.php | 2 +- library/think/db/Builder.php | 4 ++-- library/think/model/Relation.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/think/View.php b/library/think/View.php index 5f511afe..bbf87743 100644 --- a/library/think/View.php +++ b/library/think/View.php @@ -181,7 +181,7 @@ class View throw new Exception('template file not exists:' . $template, 10700); } // 记录视图信息 - APP_DEBUG && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export($vars, true) . ' ]', 'info'); + APP_DEBUG && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($vars), true) . ' ]', 'info'); } if (is_null($this->engine)) { // 初始化模板引擎 diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index 892048c2..08dbbb7e 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -299,13 +299,13 @@ abstract class Builder if ($value instanceof \Closure) { $whereStr .= $key . ' ' . $exp . ' ' . $this->parseClosure($value); } else { - $value = is_string($value) ? explode(',', $value) : $value; + $value = is_array($value) ? $value : explode(',', $value) ; $zone = implode(',', $this->parseValue($value)); $whereStr .= $key . ' ' . $exp . ' (' . $zone . ')'; } } elseif (in_array($exp, ['NOT BETWEEN', 'BETWEEN'])) { // BETWEEN 查询 - $data = is_string($value) ? explode(',', $value) : $value; + $data = is_array($value) ? $value : explode(',', $value) ; $whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($data[0]) . ' AND ' . $this->parseValue($data[1]); } elseif (in_array($exp, ['NOT EXISTS', 'EXISTS'])) { // EXISTS 查询 diff --git a/library/think/model/Relation.php b/library/think/model/Relation.php index 4b908943..62def09f 100644 --- a/library/think/model/Relation.php +++ b/library/think/model/Relation.php @@ -240,7 +240,7 @@ class Relation // 重新组装模型数据 foreach ($result->toArray() as $key => $val) { if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key); + list($name, $attr) = explode('__', $key,2); if ($name == $modelName) { $list[$name][$attr] = $val; unset($result->$key); @@ -300,7 +300,7 @@ class Relation $pivot = []; foreach ($set->toArray() as $key => $val) { if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key); + list($name, $attr) = explode('__', $key,2); if ('pivot' == $name) { $pivot[$attr] = $val; unset($set->$key);