您现在的位置是:首页 > PHP技术PHP技术
Thinkphp3.1.3中组合where条件
2019-10-14【PHP技术】2725 人已围观
简介 一些复杂的项目中我们经常需要进行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:
很赞哦! ()
相关文章
随机图文
phpstorm:如何设置代码自动换行
File->Settings->Editor 点击general勾选 “ Use soft wrap in editor ” ...
css中overflow如何清除浮动
div css布局现在是流行的网站前台的布局方式,在使用 div 嵌套时,如果子div使用了浮动float:left/right等,那么...
Thinkphp更新数据时间字段的插入
thinkphp在处理数据写入数据库时同时记录操作时间,可以用$arr['add_time'] = time();或date...
php时间戳转换
PHP常用的一些时间类函数及轮换函数.收录一下 $date = \'2014-08-04 09:53:35\'; $time = tim...




微信收款码
支付宝收款码