6], ]; } /** * @return string[] */ public function attributeLabels() { return [ 'username' => '账号', 'password' => '密码', ]; } /** * @return bool * @throws \yii\db\Exception */ public function save() { try { $manager = $this->manager; $manager->password_hash = Yii::$app->security->generatePasswordHash($this->password);; if (!$manager->save()) { $this->addErrors($manager->getErrors()); throw new NotFoundHttpException('用户编辑错误'); } return true; } catch (\Exception $e) { return false; } } }