コード例 #1
0
 /**
  * Creates a new Category model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Category();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('create_category', '文章分类添加成功:您可以继续添加新文章分类,或返回文章分类列表。');
         return $this->redirect(['create']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }