/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Adver(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Adver'])) { $model->attributes = $_POST['Adver']; $model->create_uid = Yii::app()->user->id; $model->update_uid = Yii::app()->user->id; $model->create_time = date('Y-m-d H:i:s'); $model->update_time = date('Y-m-d H:i:s'); if ($model->save()) { //$this->redirect(array('view','id'=>$model->id)); Yii::app()->user->setFlash('success', '信息提交成功!'); } else { Yii::app()->user->setFlash('success', '信息提交失败!'); } } $this->render('create', array('model' => $model)); }