php – 如何获得注册令牌?
发布时间:2020-12-13 16:04:08 所属栏目:PHP教程 来源:网络整理
导读:用户注册后,我需要提供一个用户可以用来重新发送注册的链接. 由于我必须在链接中传递令牌,我将如何生成该令牌? ex: http://dmain.com/account/confirm/resend/:token 另外,在RegistersUsers中 public function register(RegisterRequest $request) { if (co
用户注册后,我需要提供一个用户可以用来重新发送注册的链接.
由于我必须在链接中传递令牌,我将如何生成该令牌? ex: http://dmain.com/account/confirm/resend/:token 另外,在RegistersUsers中 public function register(RegisterRequest $request) { if (config('access.users.confirm_email')) { $user = $this->user->create($request->all()); event(new UserRegistered($user)); return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend')); } else { auth()->login($this->user->create($request->all())); event(new UserRegistered(access()->user())); return redirect($this->redirectPath()); } } 因此,链接生成为: return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend')); 我如何将令牌传递给trans? 'resend' => 'Your account is not confirmed. Please click the confirmation link in your e-mail,or <a href="' . route('account.confirm.resend',':token') . '">click here</a> to resend the confirmation e-mail.', 解决方法
我发现如何通过将变量作为数组传递来执行此操作:
return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend',array('token' => $token))); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |