它不起作用 显示此内容
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The POST method is not supported for this route. Supported methods: PUT, PATCH, DELETE.
<form class="form-ad" action="{{ route('jobs.store') }}" method="post" >
最佳答案
在表单标签中伪造您的补丁请求
<form class="form-ad" action="{{ route('jobs.store') }}" method="post" >
{{ method_field('POST') }} /*here i used post and solved the error*/ /*if you are using form method POST then what is the use of using {{method_field('POST')}} form "store" action? {{method_field('POST')}} is mainly used if you have a PATCH request for update action. Store action is already on POST request in your Routes.*/
<!-- rest of the form -->
</form>
此外,只是建议您可以简单地创建资源完整路由。
首先通过 artisan 命令使 Controller 资源丰富,这将创建每个方法所需的所有方法(get、post、patch 等)
php artisan make:controller Jobs -r
然后在你的routes/web.php中使用
Routes::resource('jobs');
您还可以使用 php artisan 命令查看路线
php artisan route:list
关于php - 此路由不支持 POST 方法。支持的方法 : PUT, 修补、删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55650440/