如何只获得3个ID';s来自MySQL表,使用强大的Yii框架和它';s CA活动记录/CDb标准内容


How to obtain only 3 results specified by 3 ID's from a MySQL table using the powerful Yii Framework and it's CActiveRecord/CDbCriteria compontents?

我想知道如何使用Yii:中的CActiveRecord/CDbCriteria找到这些记录

[table]         
 id | value     
 ---------------
  1 | horses    
  2 | snakes    
  3 | panteras  
  4 | commandos 

正如我所说,我只想要我将按照正确顺序指定的三个第一个女巫:1、2和3。

这怎么可能在Yii实现?

yourmodel((::model((->findAll(数组("criteria"=>id<=4();

如果id是非连续的,请对cdbcriteria对象使用addInCondition。