我正在尝试根据以下内容实现密码提醒:http://laravel.com/docs/4.2/security
我使用了artisan命令:
php artisan auth:reminders-table
php artisan migrate并将此添加到我的路由中:
Route::controller('password', 'RemindersController');
Route::get('forgotpassword', 'RemindersController@getRemind');现在,当我转到这个页面:myapp/forgotpassword时,我得到了password.remind视图
它的代码如下:
<?php include_once(app_path()."/includes/header.php"); ?>
<form action="{{ action('RemindersController@postRemind') }}" method="POST">
<input type="email" name="email">
<input type="submit" value="Send Reminder">
</form>
<?php include_once(app_path()."/includes/footer.php"); ?>当我转到此页面并单击submit form I get a NotFoundHttpException error时,如果我将表单中的操作更改为其他函数,也会发生此错误。我的路线有问题吗?或者使用我从控制器调用函数的语法?
Thx
发布于 2014-10-14 21:24:22
你应该改变:
Route::get('forgotpassword', 'RemindersController@getRemind');转到
Route::post('forgotpassword', 'RemindersController@getRemind');这是因为您使用POST方法来发送表单。
但是似乎GET和POST使用了相同的控制器方法,所以在这种情况下可能需要:
Route::match(['GET','POST'], 'forgotpassword', 'RemindersController@getRemind');https://stackoverflow.com/questions/26361941
复制相似问题