Home  >  Article  >  Backend Development  >  laravel5 表单method无法用put,delete,patch?

laravel5 表单method无法用put,delete,patch?

WBOY
WBOYOriginal
2016-06-06 20:25:131165browse

我按照文档的写法编写表单如下:

<code><input type="hidden" name="_method" value="PUT">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="text" name="title">
<input type="submit"></code>


但是得到的结果是: MethodNotAllowedHttpException in RouteCollection.php line 219:
如果是get post是正常的restful访问,单换了put...就不行。

回复内容:

我按照文档的写法编写表单如下:

<code><input type="hidden" name="_method" value="PUT">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="text" name="title">
<input type="submit"></code>


但是得到的结果是: MethodNotAllowedHttpException in RouteCollection.php line 219:
如果是get post是正常的restful访问,单换了put...就不行。

路由不对?
你有一个 Route::put('admin/haha/ht') 的路由吗?

路由里面有写对应的put吗

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn