草庐IT

CDataProvider

全部标签

php - 如何转换为在 View 中使用 Yii CDataProvider?

我正在尝试学习Yii,并查看了Yii文档,但仍然没有真正理解它。我仍然不知道如何在Controller和View上使用CDataProvider来显示View上可用的所有博客文章。任何人都可以根据以下内容提出建议或举个例子:我的PostController中的actionIndex:publicfunctionactionIndex(){$posts=Post::model()->findAll();$this->render('index',array('posts'=>$posts));));View,Index.php:除了执行上述操作,任何人都可以建议如何使用CDataProv