栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > YurunPHP

where - YurunPHP1.0开发手册

YurunPHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

where - YurunPHP1.0开发手册


连贯操作where用于指定条件,支持字符串和数组两种格式。区别是字符串是原样代入,数组则会根据配置进行值过滤和字段保留字冲突解决。

* * * * *


$model->where('id<10')->select();
$model->where(array('id'=>array('<',10)))->select();

生成的SQL语句:

select * from table where id<10


* * * * *


$model->where('id in (1,2,3)')->select();
$model->where(array('id'=>array('in',array(1,2,3))))->select();

上面两句话等同。
生成的SQL语句:

select * from table where id in (1,2,3)


* * * * *


$model->where("(age>80 or age<10) and city='无锡'")->select();
$m->where(
array(
'and'=>array(
'age'=>array('>',80),
'or'=>array(
'age'=>array('<',10)
)

)
,'city'=>'无锡'
)
)
->select();

上面两句话等同。
生成的SQL语句:

select * from table where (age > 80 or age < 10) and city='无锡'


* * * * *


$model->where('address'=>array('like'=>'%无锡%'));
$model->where('birthday'=>array('>=','1970-01-01'));
$model->select();

生成的SQL语句:`select * from table where address like '%无锡%' and birthday>='1970-01-01'`
连贯操作分开写也是没有问题的

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/213819.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号