php - vue-resource's get request cannot send parameters
天蓬老师
天蓬老师 2017-06-29 10:08:18
0
2
1017

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());  //这里在前台控制台返回的是接收到的参数,得到的结果一直为[]
    extract($request->all());
    $question=Question::find($id);
    return ApiHelper::Response(0,'success',$question);
}

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
扔个三星炸死你

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

阿神

It is recommended to use axios

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template