[ 'class' => AccessControl::className(), 'rules' => [ [ 'actions' => ['index'], 'allow' => true, 'roles' => ['@'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'logout' => ['post'], ], ], ]; } /** * @inheritdoc */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction', ], ]; } public function actionIndex() { $model = new UploadForm(); if (Yii::$app->request->isPost) { $model->file = UploadedFile::getInstance($model, 'file'); if ($model->file && $model->validate()) { $filePath = Yii::getAlias('@webroot') . '/uploads/' . $model->file->baseName . '.' . $model->file->extension; $model->file->saveAs( $filePath ); $data = new ParserHandler( $filePath ); var_dump($data); // $provider = new ArrayDataProvider([ // 'allModels' => $data, // 'pagination' => [ // 'pageSize' => 10, // ], //// 'sort' => [ //// 'attributes' => ['id', 'name'], //// ], // ]); // return $this->render('parsingResult', // ['model' => $model, // 'dataProvider' => $provider]); } } return $this->render('parser', ['model' => $model]); } }