因此,此调用在本地有效(无用),但是现在在我的linux服务器上,出现此错误。它在GET请求中发生了变化
GET https://stagiair.weareimd.be/api/profile 405 (Method Not Allowed)
axios发布方法
storeUrl() {
let vueInstance = this;
axios.post('api/profile', {
url: vueInstance.url
})
.then(function (res) {
vueInstance.url = res.data.url;
}).then(function (res) {
vueInstance.getSocials();
})
.catch(function (error) {
console.log(error);
});
},
web.php中的api路由器
Route::post('/api/profile', 'ApiController@store');
apiController
public function store(Request $request) {
$url = $request->input('url');
$user_id = Auth::id();
$student = \App\Student::find($user_id);
$student->url = $url;
$student->save();
}