Php 如何解决laravel中删除409页未找到错误?

Php 如何解决laravel中删除409页未找到错误?,php,laravel,Php,Laravel,我有这个方法,它应该调用“PostsController”中的“destroy”方法。但当我点击删除按钮,我得到“409页过期”的错误 如何解决此问题?在表单中,添加一个csrf字段。您可以这样做: <form method="POST" action="/posts/{{$post->id}}"> @csrf <input type="hidden" name="_method" value="DELETE"> &


我有这个方法,它应该调用“PostsController”中的“destroy”方法。但当我点击删除按钮,我得到“409页过期”的错误


如何解决此问题?

在表单中,添加一个
csrf
字段。您可以这样做:

<form method="POST" action="/posts/{{$post->id}}">
        @csrf
        <input type="hidden" name="_method" value="DELETE">
        <input type="submit" value="DELETE">
    </form>

@csrf

在此处阅读更多信息:

在表单中,添加一个
csrf
字段。您可以这样做:

<form method="POST" action="/posts/{{$post->id}}">
        @csrf
        <input type="hidden" name="_method" value="DELETE">
        <input type="submit" value="DELETE">
    </form>

@csrf

请在此处阅读更多信息:

csrf
缺失

您必须在表单中添加
csrf

<input type="hidden" name="_token" value="{{ csrf_token() }}">

csrf
缺失

您必须在表单中添加
csrf

<input type="hidden" name="_token" value="{{ csrf_token() }}">