本文共 436 字,大约阅读时间需要 1 分钟。
今天用TP3.2查询用户信息(条件很多啊!),悲剧来了!! 一直有一个条件不判断---也不会报错累啊
正题来了
$model = M("表明");
$model->where()->where()->......->select();
先查官方文档----官方指出 如果使用多个where()三个及三个以上的判断条件只能含有一个字符串条件
其实判断条件多个(判断范围、<>=!、值....)解决方法 一类的可以放在同一个数组中
eg:
a:$data = array(
'字段名' => 'values',
。。。。。。。。。
);
b:$date['字段名'] = array('','');
$date['字段名'] = array('','');
c:$model->where(where()->where()->where().....)->select();
现在可以将结果dump()出来 看看是否符合条件~~~~~~~~~~~~
推荐官方手册地址(参考):
转载地址:http://wiiqi.baihongyu.com/