我在RouteCollection.php中获得了MethodNotAllowedHttpException
我在我在RouteCollection.php中获得了MethodNotAllowedHttpException,php,laravel,Php,Laravel,我在RouteCollection.php 这里是service.blade.php <form ACTION="{{ url('backend/client/updateservice' ) }}" METHOD="POST" id="form1" name="form1" > <input type="hidden" name="_token" value="{{ csrf_token() }}"> </form> 这里是ClientCo
RouteCollection.php
这里是service.blade.php
<form ACTION="{{ url('backend/client/updateservice' ) }}" METHOD="POST" id="form1" name="form1" >
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
这里是ClientController.php
public function editservice()
{
$client = Client::where('ClientID','1') -> get() -> first();
return view('backend/client.service',compact('client'));
}
public function updateservice()
{
$clientUpdate = Input::all();
$client = Client::where('ClientID','1') -> get() -> first();
$client ->update($clientUpdate);
return redirect('backend/client/service');
}
您可以使用
to
而不是url
<form ACTION="{{ URL::to('backend/client/updateservice') }}" METHOD="POST" id="form1" name="form1" >
使用route()
helper函数:
<form ACTION="{{ URL::route('updataService') }}" METHOD="POST" id="form1" name="form1" >
您可以使用
而不是url
<form ACTION="{{ URL::to('backend/client/updateservice') }}" METHOD="POST" id="form1" name="form1" >
使用route()
helper函数:
<form ACTION="{{ URL::route('updataService') }}" METHOD="POST" id="form1" name="form1" >
问题在于更新服务
方法的重定向
选项。将updateservice
方法更改为此
public function updateservice()
{
$clientUpdate = Input::all();
$client = Client::where('ClientID','1') -> get() -> first();
$client ->update($clientUpdate);
return redirect('backend/client/editservice');
}
因为当它重定向时,它找不到重定向的路由问题在于更新服务
方法的重定向
选项。将updateservice
方法更改为此
public function updateservice()
{
$clientUpdate = Input::all();
$client = Client::where('ClientID','1') -> get() -> first();
$client ->update($clientUpdate);
return redirect('backend/client/editservice');
}
因为当它重定向时,找不到重定向的路由请尝试将方法名称更改为getEditservice和postUpdateservice,以及在路由中。请检查表单提交的完整错误,然后检查路由中该URL的方法。尝试将方法名称更改为getEditservice和postUpdateservice,以及在路由中。请检查表单提交的完整错误,然后检查路由中该URL的方法。不,不可能,它不在方法体中,只有当它找不到任何方法时才会发生异常不,不可能,它不在方法体中,只有当它找不到任何方法时才会发生异常第二个更好,您可以为您的RouteEyes定义一个名称我确信请尝试第二个更好,您可以为您的RouteEyes定义一个名称我确信请尝试