Bei Verwendung des Vue-Frameworks mit Vue-Ressource wird der Code unten ver?ffentlicht. Alles ist normal. Sie k?nnen jedoch keine Parameter mit get übergeben (Der von PHP empfangene Parameter ist null), bitte helfen Sie ...
js Teil:
this.$http.get('/operation/customer/question/edits',{id: 10}).then(response => {
this.question = response.body.data;
},response => {
this.error('連接錯誤');
})
php-Teil:
public function edits(Request $request){
dd($request->all()); //這里在前臺控制臺返回的是接收到的參數(shù),得到的結(jié)果一直為[]
extract($request->all());
$question=Question::find($id);
return ApiHelper::Response(0,'success',$question);
}
歡迎選擇我的課程,讓我們一起見證您的進步~~
vue GET傳遞參數(shù)要加上params
this.$http.get('/operation/customer/question/edits',{params:{id: 10}})
另外說一句,現(xiàn)在VUE官方推薦使用axios vue-resource不更新了