ThinkPHP6 多条件搜索查询,怎么实现呢?
2022-11-24 11:10:29
243
{{single.collect_count}}

经过了查看tp6文档,我从几十行代码优化到几行代码就解决了多条件搜索功能!

我查看了下文档,是使用高级查询,运用模糊查询,就可以轻松解决多条件查询功能!

好了,废话不多说,下面直接上代码

$list = Db::name('message')->field($field)->where([['repeated', 'like', $sel_join. '%'],['client', 'like', $sel_client. '%'],['url', 'like', $url. '%'],['date', 'between time', [$startTime, $endTime]],['phone', 'like', $phone. '%'],['delete_time', '=' , '0']])->order($order)->paginate(['list_rows' => $limit, 'page' => $page])->toArray();

可以多看看文档,还是有益处的!

转自:蜜雪冰城官网:http://www.mixuejm.cn/

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}