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

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

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