tp3.2的组合查询

thinkphp3.2下,怎么写以下情况的where语句,当role字段等于1或者2且home字段等于4,请问这句where怎么写?

阅读 4.4k
3 个回答
$where['_string']="(role=1 or role 2 ) and home=4 ";

先查询home等于4 然后对结果集遍历取出相应的结果

$where['role']  = array('eq', 1);
$where['role']  = array('eq',2);
$where['_logic'] = 'or';
$map['_complex'] = $where;
$map['home']  = array('eq',4);

->where($map)->select()
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进