wxml文件
<view >{{id}}</view>
js文件
Page({
data: {
id:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.request({
url: 'http://localhost:8080/phpclass/QM/C1/PHP/One/2/4.php',
data: {
id:'a',
},
method:'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success (res) {
console.log(res.data)
}
})
},
})
PHP文件
<?php
$name1 = $_POST['id'];
echo $name1;
?>
输出结果为a