标签:criteria status 优先级 where intro
$criteria->addCondition("status=1");
$criteria->addInCondition(‘is_delete=0‘);
$criteria->addSearchCondition(‘name‘,‘分类‘);
$criteria->addSearchCondition(‘intro‘,‘分类‘,true,or);
yii会解析成sql:
select * from t where status=1 and is_delete=0 and name like ‘分类‘ or intro like ‘分类‘;
这样的话实现不了name或intro字段中 只要包含分类字段,有时候还会出现status=0 也出现 ,这里面还有个优先级的问题
select * from t where status=1 and is_delete=0 and (name like ‘分类‘ or intro like ‘分类‘);
本文出自 “Linux运维” 博客,请务必保留此出处http://2853725.blog.51cto.com/2843725/1551962
标签:criteria status 优先级 where intro
原文地址:http://2853725.blog.51cto.com/2843725/1551962