public function actionAdminupdatemoment_1() { //判断信息是否填写完全 if (empty($_POST["moment_content"]) || !isset($_POST["moment_content"])) { echo '{"success":false,"msg":"内容填写错误"}'; return; // exit(); } $newmoment = new Moments(); $newmoment->Content = \yii\helpers\Html::encode($_POST['moment_content']); $newmoment->XH_ID = \Yii::$app->user->identity->XH_ID; $newmoment->Mdate = date('y-m-d'); $newmoment->Time = date('H:i:s'); $newmoment->like_Num = 0; $newmoment->save(false); echo '{"success":true,"msg":"添加成功!"}'; }