我正在尝试构建一个应用程序,以强制用户在注册时确认其电子邮件地址。我发送一封电子邮件,其中包含如下链接:
http://localhost:8000/verifieren/TOKEN&user=USERNAME
现在,当我尝试访问此链接时,屏幕上会弹出以下错误:
NotFoundHttpException in Controller.php line 91:
Controller method not found.
从堆栈跟踪中,我得到以下内容
at Controller->missingMethod(array('verifieren', 'GILDE-jOWPBRhcOW1fUFg77xnb0kgM22CUm4&user=Wesley'))
我认为这意味着它试图verifieren
作为方法调用?
这是我使用的路线:
Route::get('/verifieren/{{ confirmation_code }}&user={{ username }}', 'Authentication\AuthenticationController@mailConformation');
该路由对应于以下方法:
public function mailConfirmation($code, $username) {
$user = User::where(["confirmation_code" => $code, "username" => $username])->first();
$user->active = '1';
$user->confirmation_code = null;
$user->active_date = date('Y-m-d');
$user->save();
return redirect('/welkom')->with("flash_notice", "account_succesfully_activated");
}
我完全不知道为什么会这样。我以为可能是其他路线干扰了,但事实并非如此。
对我来说,这是相当新的东西,因此我可以想象我在代码中犯了一个菜鸟错误。
提前致谢。
路径和控制器方法名称中方法名称的拼写错误
在路由中,方法名称为
@mailConformation
但是在您的Controller中,您的方法名称是
mailConfirmation($code,$username)
因此,将路径中方法名称的拼写更正为:
Route::get('/verifieren/{{ confirmation_code }}&user={{ username }}', 'Authentication\AuthenticationController@mailConfirmation');
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句