您现在的位置是:首页 > PHP技术PHP技术
Thinkphp3.1.3中组合where条件
2019-10-14【PHP技术】1955 人已围观
简介 一些复杂的项目中我们经常需要进行where条件的组合.二组where组合语法如下$where[‘name’]...
一些复杂的项目中我们经常需要进行where条件的组合. 二组where组合语法如下
$where[‘name’] = array(‘like’, ‘%thinkphp%’); $where[‘title’] = array(‘like’,’%thinkphp%’); $where[‘_logic’] = ‘or’; $map[‘_complex’] = $where; //申明map与where组合 _complex $map[‘id’] = array(‘gt’,1);
最终生成sql
( (namelike’%thinkphp%’)OR(titlelike’%thinkphp%’) ) and id>1
关注宁波网站建设博客,更多精彩分享,敬请期待!
Tags:
很赞哦! ()
相关文章
随机图文
在HTML中引入css的其中的两个方法
1在HTML中引入css的其中的两个方法1.1 使用链接式link href="style.css" rel="...Mysql进阶之in详解
MySQL IN 语法 IN 运算符用于 WHERE 表达式中,以列表项的形式支持多个选择,语法如下: WHERE column IN ...Thinkphp5.1.30 分页think\paginator\driver\Bootstrap has no effect解决
Tp5.1.30对以往版本有很大的改进。$list = Db:name('表名')->paginate(10);返...网站安全代码thinkphp3.1密码强度检测
/** *检查密码复杂度 */ publicfunctioncheckPassword($pwd){ if($pwd==null){...