gpt4 book ai didi

laravel-5 - 不允许使用 Vue.js PATCH 方法

转载 作者:搜寻专家 更新时间:2023-10-30 22:44:42 25 4
gpt4 key购买 nike

大家好,POST 和 GET 方法适用于我的应用程序,但 PATCH 方法不行。在我的 WAMP 服务器上一切正常。在 VPS 服务器上 - 不要。我收到 405 方法不允许。

我正在使用: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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com