2014-08-27 127 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

相關問題