This paper describes the differences between Carraydataprovider and Cactivedataprovider in Yii. Share to everyone for your reference, as follows:
1, Carraydataprovider
Get a 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
Get the data list for the current model
$dataProvider =new cactivedataprovider (' photoattachment ', Array (' Pagination ' =>array (' pageSize ' =>20), ' Criteria ' =>array (' condition ' =>implode (' and ', $condition), ' order ' = ' id DESC ',//' with ' =>array (' author ') ),),));
For more information on YII related content readers can view this site topic: "YII framework Introduction and common skills Summary", "PHP Excellent Development Framework Summary", "Smarty Template Primer Basic Tutorial", "PHP date and Time usage summary", "PHP object-oriented Programming introduction Tutorial", " PHP String Usage Summary, "Getting Started with Php+mysql database operations" and "PHP Common Database Operations Skills Summary"
It is hoped that this article is helpful to the PHP program design based on YII framework.