ThinkPHP3.2 where条件 and,or同时使用 _logic
super
2020-07-01 11:57
4593
环境:ThinkPHP3.2 需求:WHERE条件需用到AND和OR进行查询 解决: $where1['condition_1'] = 1; $where2['condition_2'] = 2; // $where1 $where2 可以是多维数组 // 例: // $where1['condition_1'] = 1; // $where1['condition_2'] = 2; // $where2['condition_1'] = 1; // $where2['condition_2'] = 2; $where['_complex'] = array( $where1, $where2, '_logic' => 'or' ); $where['status'] = 1; M('tb_name')->where($where)->select();
0 条讨论