简体   繁体   English

Laravel表单提交在RouteCollection.php第218行显示MethodNotAllowedHttpException:

[英]Laravel form submit showing MethodNotAllowedHttpException in RouteCollection.php line 218:

This is my route 这是我的路线

Route::resource('admin/reports', 'ReportController');

This is controller function 这是控制器功能

public function store(Request $request)
{
    return "Thank you";
}

This is my html code 这是我的HTML代码

{!! Form::open([ 'url' => 'admin/reports/store', 'files' => true, 'enctype' => 'multipart/form-data', 'class' => 'dropzone', 'id' => 'reportfile' ]) !!}
    {!! csrf_field() !!}
    <div class="col-md-12">
        <h3 style="text-align : center">Select File</h3>
    </div>

    <div class="col-md-12" style="text-align: center; padding: 10px">
        <button type="submit" class="btn btn-primary">Upload Report</button>

    </div>
    {!! Form::close() !!}

When I submit the form, it show me MethodNotAllowedHttpException in RouteCollection.php line 218: 当我提交表单时,它会在RouteCollection.php第218行显示MethodNotAllowedHttpException:

Any help is much appreciated. 任何帮助深表感谢。 Thanks 谢谢

Your form action should just be admin/reports. 您的表单操作应该只是admin / reports。

Currently it will assume you are trying to post to the route admin/reports/{id}. 目前,它将假设您尝试发布到admin / reports / {id}路由。 That endpoint is used with GET, PUT and DELETE. 该端点与GET,PUT和DELETE一起使用。

Check the docs including a table giving you routes https://laravel.com/docs/5.1/controllers#restful-resource-controllers if I were you I'd use the route helper to generate your urls for you 检查文档,包括一个表格,给你路线https://laravel.com/docs/5.1/controllers#restful-resource-controllers如果我是你我会使用路线助手为你生成你的网址

暂无
暂无

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

相关问题 RouteCollection.php第218行中的Laravel MethodNotAllowedHttpException: - Laravel MethodNotAllowedHttpException in RouteCollection.php line 218: Laravel中RouteCollection.php第218行的MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 218 in Laravel RouteCollection.php 第 218 行中的 Laravel 5.2.36 MethodNotAllowedHttpException: - Laravel 5.2.36 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 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: RouteCollection.php行218 Laravel 5.2中的MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 218 Laravel 5.2 routecollection.php第218行中的methodnotallowedhttpexception - methodnotallowedhttpexception in routecollection.php line 218 RouteCollection.php第218:4行中的MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 218:4 提交表单时出现Laravel错误:RouteCollection.php第218行中出现MethodNotAllowedHttpException。这可能是由于什么? - Laravel error upon submitting a form: MethodNotAllowedHttpException in RouteCollection.php line 218. What could this be due to?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM