您现在的位置是:首页 > PHP技术PHP技术
Thinkphp3.1.3中组合where条件
2019-10-14【PHP技术】1595 人已围观
简介 一些复杂的项目中我们经常需要进行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:
很赞哦! ()
相关文章
随机图文
php变量布尔值验证详细参考
使用 PHP 函数对变量$x进行比较表达式gettype()empty()is_null()isset()boolean:if($x)$x ...Thinkphp5.1.30 分页think\paginator\driver\Bootstrap has no effect解决
Tp5.1.30对以往版本有很大的改进。$list = Db:name('表名')->paginate(10);返...高级php程序员需要具备的技能
有网友问高级PHP程序员需要具备哪些技能,应该怎么学习?殷雯小编认为初级的php程序员具备开发和前端。高级的程序员应该是开发+前端+运维。既...Thinkphp5.1 截取新闻标题长度的办法
tp5.1和原生php一样,在截取新闻标题长度的时候都是一样的考虑.中文在字符串的处理中比英文要多考虑一些东西,因为英文占一个位,中文占...