【问题标题】:Laravel 7.6 419 page expired on form submissionLaravel 7.6 419 页面在表单提交时过期
【发布时间】:2020-05-04 21:23:53
【问题描述】:

我正在尝试提交一个表单,它只是将我重定向到未指定的位置(到文件夹/index.blade.php),而没有使用 419 Page Expired 保存表单。我尝试了其他方法来重定向到我想要的地方,但它不起作用。我已经为正在运行的博客构建了一个 crud,并且我创建了另一个控制器来保存联系表单。

<form role="form" method="POST" enctype="text/plain" action="{{action('LeadsController@store')}}">

        @csrf

        <div class="form-group">
            <label for="name">Name</label>
            <input type="text" name="name" value="" class="form-control" autocomplete="off" placeholder="Name">
        </div>

        <div class="form-group">
            <label for="email">Email</label>
            <input type="email" name="email" value="" class="form-control" autocomplete="off" placeholder="Email">
        </div>

        <div class="form-group">
            <label for="phone">Phone</label>
            <input type="text" name="phone" value="" class="form-control" autocomplete="off" placeholder="Phone">
        </div>

        <div class="form-group">
            <label for="requirement">Requirement</label>
            <input type="text" name="requirement" value="" class="form-control" autocomplete="off" placeholder="requirement">
        </div>


        <button type="submit" class="btn btn-outline-primary">Submit</button>

        </form>

【问题讨论】:

  • 您在表单中添加了@csrf 吗?
  • 是的。我加了。
  • 试试这个工具以获得更多信息 => composer 需要 barryvdh/laravel-debugbar --dev
  • 请分享你的代码'blade view`
  • Laravel 的版本是什么

标签: php laravel


【解决方案1】:

确保您已将“网络”中间件用于表单端点路由。这个中间件负责网络会话

【讨论】:

  • 有网络中间件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-11-19
  • 2019-08-15
  • 2020-05-22
  • 2022-06-11
  • 2020-09-28
  • 2018-06-08
相关资源
最近更新 更多