In Yii, CArrayDataProvider and CActiveDataProvider differentiate instance analysis, and carraydataprovider
This article describes the differences between CArrayDataProvider and CActiveDataProvider in Yii. We will share this with you for your reference. The details are as follows:
1. CArrayDataProvider
Obtains the data list of other databases or data tables.
$ SQL = "Select * from tbl_count2 order by id desc"; $ data = Yii: app ()-> marketdb-> createCommand ($ SQL)-> queryAll (); $ dataProvider = new CArrayDataProvider ($ data, array ('pagination' => array ('pagesize' => 16 ,),));
2. CActiveDataProvider
Obtains the data list of the current model.
$ DataProvider = new CActiveDataProvider ('photoattachment ', array ('pagination' => array ('pagesize' => 20 ), 'critera' => array ('condition '=> implode ('and', $ condition), 'order' => 'id DESC ', // 'with' => array ('author '),),));