谁能告诉我为什么不能接到值???
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