tp框架多个OR与And连用查询笔记

来源:互联网 发布:为什么需要软件测试 编辑:程序博客网 时间:2024/04/23 19:11

例如查询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();

0 0
原创粉丝点击