public function actionDeleteTrainUsers() { $trainId = \Yii::$app->request->get('id'); $model = TrainUsers::deleteAll(['id' => $trainId]); if ($model) { return $this->redirect('index'); } else { throw new ServerErrorHttpException('删除失败,原因:' . json_encode($model->errors, JSON_UNESCAPED_UNICODE)); } }