public function actionCategoryCreate() { $model = new models\RbacTaskCategory(); $model->scenario = 'create'; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['category-admin']); } // 验证失败:$errors 是一个包含错误信息的数组 //$errors = $model->errors; return $this->render('/rbac/authtask/category_form', ['model' => $model]); }