THINKPHP and or 模板语句书写

 

select * from xx where (a = 22 or b = 333) or (c=11 and d=22)

$where_1['a'] = array('eq', '222');
$where_2['b'] = array('eq','333');

$where_3['c'] = 11;
$where_4['d'] = 22;

$map['_complex'][] = [
      $where_1,$where_2,
      '_logic'=>'or',
  ];
$map['_complex'][] = [
      $where_3,$where_4,
      '_logic'=>'or',
];

$this->where($map)->select();


  

posted @ 2019-03-06 17:36  飞翔的小鸟11  阅读(558)  评论(0编辑  收藏  举报