switch ($key) {
case in_array($key, ['=', '>', '<', '>=', '<=', '<>']):
$this->where .= " AND $value $key ?";
break;
case 'like':
$this->where .= " AND $value LIKE ?";
$item = "%$item%";
break;
case 'like-L':
$this->where .= " AND $value LIKE ?";
$item = "%$item";
break;
case 'like-R':
$this->where .= " AND $value LIKE ?";
$item = "$item%";
break;
}
switch ($key) {
case in_array($key, ['=', '>', '<', '>=', '<=', '<>']):
$this->where .= " AND $value $key ?";
break;
case in_array($key, ['like', 'like-L', 'like-R']):
$this->where .= " AND $value LIKE ?";
if ($key === 'like') {
$item = "%$item%";
break;
};
if ($key === 'like-L') {
$item = "%$item";
break;
}
if ($key === 'like-R') {
$item = "$item%";
}
break;
default:
//
}
有更好的 还请大家分享一下 谢谢
- 3 回答
- 0 关注
- 397 浏览
添加回答
举报
0/150
提交
取消