您现在的位置是:首页 > PHP技术PHP技术
Thinkphp3.1.3中组合where条件
2019-10-14【PHP技术】2197 人已围观
简介 一些复杂的项目中我们经常需要进行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 str_pad函数使用注意点
定义和用法str_pad() 函数把字符串填充为新的长度。语法str_pad(string,length,pad_string,pad_ty...
PHP学习笔记:PHP遍历数组的几种方法
PHP中遍历数组有三种常用的方法: 一、使用for语句循环遍历数组; 二、使用foreach语句遍历数组; 三、联合使用list()、...
mysql常见的多表查询语句
select*fromTable1,Table2whereTable1.id=1andTbale2.id-2(是某一相同字段)注意这样的查询...
php变量布尔值验证详细参考
使用 PHP 函数对变量$x进行比较表达式gettype()empty()is_null()isset()boolean:if($x)$x ...




微信收款码
支付宝收款码