码迷,mamicode.com
首页 > Web开发 > 详细

thinkphp 多个字段的不同关系的查询条件实现 .

时间:2017-10-26 13:23:23      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:sel   logic   sele   默认   查询   thinkphp   log   select   实现   

tp的$map不同条件默认是 and ,如果要用or<><><><>如下

例如查询Stu表中年龄大于18,或者身高低于180cm的男性(1为男性),(例子不太好标题有可能不符,望见谅)

$where[‘age‘] = array("gt",18);

$where[‘height‘] =array("lt",180);

$where[‘_logic‘] = "OR";

$map["_complex"] = $where;

$map[‘sex‘] = 1;

$res = M("Stu")->where($map)->select();

thinkphp 多个字段的不同关系的查询条件实现 .

标签:sel   logic   sele   默认   查询   thinkphp   log   select   实现   

原文地址:http://www.cnblogs.com/jinshuo/p/7736005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!