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


  

相关文章

(1)创建数据表: CREATE TABLE IF NOT EXISTS `think_form` ...
组合查询的主体还是采用数组方式查询,只是加入了一些特殊的...
(1)创建模版:/App/Home/View/Form/edit.html   <FORM m...
自定义配置文件user.php: <?php return array(    \'se...
在一些成熟的CMS系统中,后台一般都包含一个配置中心(如织梦...
废话不多说先上图预览下,即本博客的分页; 这个分页类是在...