大家好,POST 和 GET 方法可以在我的应用程序上运行,但 PATCH 方法不能。在我的 WAMP 服务器上一切正常。在 VPS 服务器上 - 不要。我收到 405 Method not allowed.
我正在使用:Laravel 5.4,Vue.js 2。
补丁方法:
axios.patch('/profile/' + this.profile.id + '/update', this.overview)
.then(resp => {
this.successDataSave(resp.data)
})
路线:
Route::patch('/profile/{profile}/update', 'AppController@update');
编辑:PATCH方法仅在axios上有效,如果我在html表单上使用补丁路由,则使用 {{ method_field('PATCH') }} 它有效。
最佳答案
使用{{ method_field('PATCH') }}
生成以下 html:
<input type="hidden" name="_method" value="PUT">
所以尝试设置:this.overview._method = "PUT"
然后发表帖子:
axios.post('/profile/' + this.profile.id + '/update', this.overview)
.then(resp => {
this.successDataSave(resp.data)
})
关于laravel-5 - 不允许 Vue.js PATCH 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43206233/