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();


  

THINKPHP and or 模板语句书写

原文地址:https://www.cnblogs.com/renshi/p/10484723.html

为您推荐

发表评论

电子邮件地址不会被公开。 必填项已用*标注