1,第一步获取前端页面传过来的数据
2,编写where条件数组

$input=input(“name”);

2,编写where条件数组 编写的时候注意数组格式 ,这里就直接上图了

基于Tp5.1小程序搜索接口
数组条件可以替换成自己需要的条件,我这里用的都是模糊查询
3, 使用 多条件whereOr 进行查询

$ list=Db::table(‘company_account’)->whereOr($where) ->select();

4,获取数据查询长度

$ count=count($list);

5,返回数据

return json([‘code’=>200,‘data’ => $list,‘count’ => $count]);

上原图
基于Tp5.1小程序搜索接口

相关文章:

  • 2022-12-23
  • 2021-08-07
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2022-01-02
猜你喜欢
  • 2021-04-26
  • 2022-01-11
  • 2021-06-26
  • 2022-12-23
  • 2022-01-15
  • 2022-01-18
  • 2021-12-06
相关资源
相似解决方案