改进Query类where方法

This commit is contained in:
thinkphp
2016-10-26 11:34:36 +08:00
parent 39cbbc0a38
commit 087e968b80

View File

@@ -906,14 +906,10 @@ class Query
if (is_array($field)) { if (is_array($field)) {
// 数组批量查询 // 数组批量查询
$where = $field; $where = $field;
} elseif ($field) { } elseif ($field && is_string($field)) {
// 字符串查询 // 字符串查询
if (is_numeric($field)) {
$where[] = ['exp', $field];
} else {
$where[$field] = ['null', '']; $where[$field] = ['null', ''];
} }
}
} elseif (is_array($op)) { } elseif (is_array($op)) {
$where[$field] = $param; $where[$field] = $param;
} elseif (in_array(strtolower($op), ['null', 'notnull', 'not null'])) { } elseif (in_array(strtolower($op), ['null', 'notnull', 'not null'])) {