Using the vue framework, paired with vue-resource, the code is posted below. The interface on the landing page uses post requests. Everything is normal. You can pass parameters and receive return values, but on this page, you cannot use get to pass them. Parameters (the parameters received by php are null), please help....
js part:
this.$http.get('/operation/customer/question/edits',{id: 10}).then(response => {
this.question = response.body.data;
},response => {
this.error('連接錯誤');
})
php part:
public function edits(Request $request){
dd($request->all()); //這里在前臺控制臺返回的是接收到的參數(shù),得到的結果一直為[]
extract($request->all());
$question=Question::find($id);
return ApiHelper::Response(0,'success',$question);
}
歡迎選擇我的課程,讓我們一起見證您的進步~~
Vue GET transfer parameters must be added with params
this.$http.get('/operation/customer/question/edits',{params:{id: 10}})
In addition, VUE officially recommends using axios vue-resource and it will not be updated