MethodNotAllowedHttpException

MethodNotAllowedHttpException

本文介绍了Laravel 5 MethodNotAllowedHttpException PUT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新用户,但是当我按下提交"按钮时,Laravel抛出以下错误:

I am trying to update a user, but when I hit the submit button, Laravel throws the below error:

我认为不允许使用PUT方法,但是我不明白原因.该请求永远不会到达UserController@update.

I think that the PUT method is not allowed, but I do not understand the reason. The request never reaches UserController@update.

我已经配置了这样的资源路由:

I have configured a resource route like this:

Route::resource('backend/users', 'Backend\UsersController');

php artisan route:list的输出是:

The output of php artisan route:list is:

推荐答案

我解决了这样的问题:它一定是表单的后期处理错误;

I solved the problem like this: it must be the form's post action error;

<form method="POST" action="10.241.229.1/backend/users/{{$user->id}}"; accept-charset="UTF-8">

将要更新的ID添加到操作中.

add the id you want update to the action.

这篇关于Laravel 5 MethodNotAllowedHttpException PUT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 18:30