$User = M("User"); // 实例化User对象
$map['id'] = array('neq',1);
$map['name'] = 'ok';
$map['_string'] = 'status=1 AND score>10';
$User->where($map)->select();
最后转化为:
( `id` != 1 ) AND ( `name` = 'ok' ) AND ( status=1 AND score>10 )
2
$map['id'] = array('gt','100');
$map['_query'] = 'status=1&score=100&_logic=or';
转化为:
`id`>100 AND (`status` = '1' OR `score` = '100')
3
$where['name'] = array('like', '%thinkphp%');
$where['title'] = array('like','%thinkphp%');
$where['_logic'] = 'or';
$map['_complex'] = $where;
转化为:
$map['id'] = array('gt',1);
( id > 1) AND ( ( name like '%thinkphp%') OR ( title like '%thinkphp%') )
来源:http://document.thinkphp.cn/manual_3_2.html#combine_query