2014-08-27 84 views
0

形式MethodNotAllowedHttpException Laravel 4

{{Form::open(array('action' => '[email protected]')) }} 

我的HomeController

public function register() 
{ 
    $user = new User; 

    $user->password = Hash::make(Input::get('password')); 
    $user->email = Input::get('email'); 
    $user->house = Input::get('house'); 
    $user->phone = Input::get('phone'); 
    $user->name = Input::get('name'); 
    $user->last_name = Input::get('last_name'); 

    $user-> save(); 
    return Redirect::to('/'); 
}  

路线

Route::get('/register','[email protected]'); 
Route::get('/home/register','[email protected]'); 

的从正确显示,但是当我按一下按钮我得到一个错误

Symfony \ Compo nent \ HttpKernel \ Exception \ MethodNotAllowedHttpException

回答

1

MethodNotAllowedHttpException表示路由很好,但方法错误。

您必须创建它作为一个POST路线:

Route::post('/home/register','[email protected]'); 
+0

你说得对!非常感谢 – 2014-08-27 19:47:40

相关问题