基本上我试图在这里做的是获取基于某个字段的帖子,我已经使用了每个用于那个,之后我想获得所有其他帖子。我该怎么办?
$criteria=new CDbCriteria(array(
'order'=>'create_time,likes DESC',
));
foreach ($str_priority as $key=>$val) {
if($key!="")
$criteria->compare('tag',$key,true,'OR',true);
}
$criteria->compare('tag',"",true,'OR',true);
$total = Post::model()->count();
$pages = new CPagination($total);
$pages->pageSize = 10;
$pages->applyLimit($criteria);
$posts = Post::model()->findAll($criteria);
答案 0 :(得分:0)
你可以尝试这样的
$criteria->addInCondition('tag', $str_priority, 'OR');