首页 > Web开发 > 详细

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

时间:2017-10-26 12:25:59      阅读:240      评论:0      收藏:0      [点我收藏+]

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 多个字段的不同关系的查询条件实现 .

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!