public function actionForgetpsw() { $UserRetrievePswForm = new UserRetrievePswForm(); $req = Yii::$app->request; if (!$UserRetrievePswForm->load($req->post()) || !$UserRetrievePswForm->validate()) { return $this->render(FVariable::$siteForgetpsw_view, ['UserRetrievePswForm' => $UserRetrievePswForm]); } $UserModel = new User(); $mobile = $UserRetrievePswForm->forgetMobile; $newPsw = md5($UserRetrievePswForm->forgetPassword); $UserUpdataPsw = $UserModel->updateUserByPsw($mobile, $newPsw); if ($UserUpdataPsw) { $UserModel->logOut(); echo "<script>alert('密码修改成功!');window.location = '/site/login';</script>"; } }