我想获取的一串数组中,不想获取content 这个字段,于是查看文档
tp5查询数据库排除某字段
找到这个方法
 
通常你想要查找某个字段,在field中加入字段名,可是这样写字段多了太麻烦,是不是还有其他方法呢
于是乎找到了下面的方法,原来field还有第二个值
$list = Db::name('post')->field('content',true)->where(['status'=>1,'cid'=>$cid,'is_product'=>0])->order('ctime desc,id desc')->paginate(15);
当为true时,为排除这个字段,ok,问题解决
tp5查询数据库排除某字段
 

相关文章:

  • 2022-12-23
  • 2021-09-10
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-04
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
相关资源
相似解决方案