微信小程序小游戏demo php怎么接值

谁能告诉我为什么不能接到值???
wx.request({
url: config.service.cheshiUrl, //仅为示例,并非真实的接口地址
data: { 'x': '1',
'y':'2'
},
smethod: 'POST',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: function (res) {
console.log(res.data)
}
})

------------------php-----------------
class Cheshi extends CI_Controller {
public function onRequest($data) {

$this->json([
'code' => 012,
'data' => [
'x' => $x,
'y' => $y
]
]);
}
}
onRequest($data),曾经改过($x,$y)也接不到值

CI框架获取post参数方法:

<?php

$x = $this->input->post('x');
$y = $this->input->post("y");
温馨提示:答案为网友推荐,仅供参考
相似回答