drt96856 2017-06-20 06:38
浏览 103

我在RouteCollection.php中得到了MethodNotAllowedHttpException

i got error message MethodNotAllowedHttpException in RouteCollection.php

here is service.blade.php

<form ACTION="{{ url('backend/client/updateservice' ) }}" METHOD="POST" id="form1" name="form1" >
   <input type="hidden" name="_token" value="{{ csrf_token() }}">     
</form>

here is route.php

Route::get('backend/client/editservice','Backend\ClientController@editservice');
Route::post('backend/client/updateservice','Backend\ClientController@updateservice');

here is 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');
}
  • 写回答

2条回答 默认 最新

  • douyeyan0650 2017-06-20 06:43
    关注

    You can use to instead of url

    <form ACTION="{{ URL::to('backend/client/updateservice') }}" METHOD="POST" id="form1" name="form1" >
    

    Or

    Route::post('backend/client/updateservice',array('uses'=>'Backend\ClientController@updateservice','as'=>'updataService'));
    

    Use route() helper function for that:

    <form ACTION="{{ URL::route('updataService') }}" METHOD="POST" id="form1" name="form1" >
    
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀