Laravel 5 : Method Not Allowed Http Exception in Route Collection.php line 201:

前端 未结 1 1800
逝去的感伤
逝去的感伤 2021-01-21 10:17

I have a sign-up form and getting the sign-up form values in routes.php. My rout.php code is :

Route::get(\'/\', function () {

    ret         


        
1条回答
  •  無奈伤痛
    2021-01-21 10:39

    You have correctly registered a route with the post method on the page /register, but in the form you do a post to the index route. Change

       

    to

                
       
    

    to send the post values to the register route instead of the index route. You don't return a view or redirect at the end of your register function so I would either add return view('index'); or return redirect('index'); as last line of your register function to redirect the user to the index page (or just return the index view)

    Alternatively you can change the index route to accept post values:

    Route::post('/index', function(){
        return view('index');
    });
    

    0 讨论(0)
提交回复
热议问题