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);