简体   繁体   English

routecollection.php第218行中的methodnotallowedhttpexception

[英]methodnotallowedhttpexception in routecollection.php line 218

I know this is duplicate problem. 我知道这是重复的问题。 Still I'm not able to correct this problem so can anyone help? 我仍然无法解决此问题,所以有人可以帮忙吗?

Routes.php Routes.php

   Route::post('/form-submit',[
   'uses' => 'UserController@formSubmit',
   'as' => 'f.submit',
]);

UserController.php UserController.php

public function formSubmit() #form-submit
{
   echo"Form Submit Method";
}

test_view.php test_view.php

@extends('Layout.master')
@section('Content')
 {!! Form::open([
         'route' => 'f.submit', 'method' => 'post'
 ]) !!}
  {!! Form::test('username') !!}
  {!! Form::submit('submit')!!}
 {!! Form::close() !!}
@endsection

If I'm using get method for this code. 如果我在此代码中使用get方法。 then directly it is showing Form Submit Method and if I'm using post method then it is showing above error 然后直接显示Form Submit Method ,如果我正在使用post方法,则显示上述错误

您需要在表单内的请求中传递csrf令牌。

i think 我认为

 //change '/form-submit' to 'f.submit'
    Route::post('/f.submit',[
       'uses' => 'UserController@formSubmit',
       'as' => 'f.submit',
    ])

and add csrf token also 并添加csrf令牌

I was getting directly "Form Submit Method" rather than it should open test_view form. 我直接获取“表单提交方法”,而不是打开test_view表单。 I have a solution for it using POST or GET method. 我有一个使用POST或GET方法的解决方案。

    Route::post('/form-submit',['
        'uses' => 'UserController@formSubmit'
        'as' => 'f.submit'
  ']});

But POST method still not working. 但是POST方法仍然无法正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RouteCollection.php第218行中的Laravel MethodNotAllowedHttpException: - Laravel MethodNotAllowedHttpException in RouteCollection.php line 218: RouteCollection.php第218:4行中的MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 218:4 Laravel中RouteCollection.php第218行的MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 218 in Laravel RouteCollection.php第218行中的MethodNotAllowedHttpException我该怎么办? - MethodNotAllowedHttpException in RouteCollection.php line 218 what can I do? RouteCollection.php 第 218 行中的 Laravel 5.2.36 MethodNotAllowedHttpException: - Laravel 5.2.36 MethodNotAllowedHttpException in RouteCollection.php line 218: Laravel表单提交在RouteCollection.php第218行显示MethodNotAllowedHttpException: - Laravel form submit showing MethodNotAllowedHttpException in RouteCollection.php line 218: RouteCollection.php第218行中的MethodNotAllowedHttpException关于更新数据的laravel 5.2 - MethodNotAllowedHttpException in RouteCollection.php line 218 laravel 5.2 on update data 如何解决RouteCollection.php第218行中的MethodNotAllowedHttpException :? - How to solve MethodNotAllowedHttpException in RouteCollection.php line 218:? laravel 5.3 RouteCollection.php第218行中的MethodNotAllowedHttpException: - laravel 5.3 MethodNotAllowedHttpException in RouteCollection.php line 218: RouteCollection.php第218行中的Laravel XMLHttpRequest MethodNotAllowedHttpException: - Laravel XMLHttpRequest MethodNotAllowedHttpException in RouteCollection.php line 218:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM