【问题标题】:yii2 view can't find the packageyii2查看找不到包
【发布时间】:2015-05-13 10:05:57
【问题描述】:

我在控制器上创建了一个动作:

public function actionReports(){

        return $this->render('reports', []);
    }

我有以下视图“报告”:

<?
use frontend\models\ReportsActiveRecord;
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
?>

<div>    


    <?php
    $dataProvider = new ActiveDataProvider([
        'query' => ReportsActiveRecord::find(),
        'pagination' => [
            'pageSize' => 5,
        ],
    ]);
    echo GridView::widget([
        'dataProvider' => $dataProvider,
    ]);    
    ?>
</div>

我在高级应用程序的前端并且收到此错误:

PHP 致命错误 - yii\base\ErrorException Class 'GridView' not found

我不知道为什么,或者我在这里遗漏了什么?

谢谢

【问题讨论】:

标签: php yii2 yii2-advanced-app


【解决方案1】:

在你的第一行&lt;? 应该是&lt;?php

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 2018-12-30
    • 2015-04-19
    相关资源
    最近更新 更多