From b7f7a8a2a764cc92c5398930a01ed1767d93e295 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 6 Dec 2016 08:07:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=A4=9A=E8=A1=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=AD=97=E6=AE=B5=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Builder.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index c60d139a..f830d876 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -90,7 +90,7 @@ abstract class Builder $result = []; foreach ($data as $key => $val) { $item = $this->parseKey($key, $options); - if (!in_array($key, $fields, true)) { + if (false === strpos($key, '.') && !in_array($key, $fields, true)) { if ($options['strict']) { throw new Exception('fields not exists:[' . $key . ']'); } @@ -100,9 +100,10 @@ abstract class Builder $result[$item] = 'NULL'; } elseif (is_scalar($val)) { // 过滤非标量数据 - if ($this->query->isBind(substr($val, 1))) { + if (0 === strpos($val, ':') && $this->query->isBind(substr($val, 1))) { $result[$item] = $val; } else { + $key = str_replace('.', '_', $key); $this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR); $result[$item] = ':' . $key; }