ThinkPHP5.1 SQL语句使用多个like
super
2020-10-21 18:11
4694
$map = [];
$value1 = 1;
$value2 = 2;
$value3 = 3;
$map[] = [
'field_name', // 字段
['like', '%' . $value1 . '%'], // like 1
['like', '%' . $value2 . '%'], // like 2
['like', '%' . $value3 . '%'], // like 3
// like ...
'or'
];
Db::name('tb_name')->where($map)->find();
0 条讨论