My Routes are Returning a 404, How can I Fix Them?

前端 未结 18 1098
栀梦
栀梦 2020-12-23 10:44

I\'ve just started learning the Laravel framework and I\'m having an issue with routing.

The only route that\'s working is the default home route that\'s attached to

18条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 11:36

    Have you tried adding this to your routes file instead Route::get('user', "user@index")?

    The piece of text before the @, user in this case, will direct the page to the user controller and the piece of text after the @, index, will direct the script to the user function public function get_index().

    I see you're using $restful, in which case you could set your Route to Route::any('user', 'user@index'). This will handle both POST and GET, instead of writing them both out separately.

提交回复
热议问题