示例#1
0
 public function actionShop1()
 {
     $model = new Shop();
     if ($model->load(yii::$app->request->post()) && $model->validate()) {
         yii::$app->session->setFlash('success', 'You have entered the data correctly');
     }
     return $this->render('shopForm', ['model' => $model]);
 }
示例#2
0
 public function actionCreate()
 {
     $model = new Shop();
     if ($model->load(Yii::$app->request->post())) {
         // 获取用户输入的数据,验证并保存
         $model->create_time = date('Y-m-d H:i:s');
         if ($model->save()) {
             $this->redirect('/shop/index');
         }
     }
     return $this->renderAjax('create', array('model' => $model));
 }