From e13c825aa725577ff0c1b6c8842ee4ffef2006b7 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 12 May 2017 11:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=94=E8=BE=83=E8=BF=90=E7=AE=97=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BD=BF=E7=94=A8=E9=97=AD=E5=8C=85=E5=AD=90=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Builder.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index 019b03f8..7a589d08 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -348,9 +348,14 @@ abstract class Builder $whereStr = ''; if (in_array($exp, ['=', '<>', '>', '>=', '<', '<='])) { - // 比较运算 及 模糊匹配 - $whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($value, $field); + // 比较运算 + if ($value instanceof \Closure) { + $whereStr .= $key . ' ' . $exp . ' ' . $this->parseClosure($value); + } else { + $whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($value, $field); + } } elseif ('LIKE' == $exp || 'NOT LIKE' == $exp) { + // 模糊匹配 if (is_array($value)) { foreach ($value as $item) { $array[] = $key . ' ' . $exp . ' ' . $this->parseValue($item, $field);