<code> wx.request({ url: 'wxapp.php', data: { x: '12' , y: '34' }, header: { 'Content-Type': 'application/json' }, success: function(res) { console.log(res.data) } }) </code>
php:
<code><?php $x=$_GET['x']; $y=$_GET['y']; $z=['x'=>$x,'y'=>$y]; echo json_encode($z);</code>
Dang
<code> data: { x: '12' , y: '34' }</code>
Return
<code>1234</code>
Dang
<code> data: { x: '123' , y: '343' }</code>
Return
<code>Object {x: "123", y: "343"}</code>
Modified again
<code> data: { x: '12' , y: '34' }</code>
Compile, clear cache, restart
Return
<code>1234</code>
What is this situation?
<code> wx.request({ url: 'wxapp.php', data: { x: '12' , y: '34' }, header: { 'Content-Type': 'application/json' }, success: function(res) { console.log(res.data) } }) </code>
php:
<code><?php $x=$_GET['x']; $y=$_GET['y']; $z=['x'=>$x,'y'=>$y]; echo json_encode($z);</code>
Dang
<code> data: { x: '12' , y: '34' }</code>
Return
<code>1234</code>
Dang
<code> data: { x: '123' , y: '343' }</code>
Return
<code>Object {x: "123", y: "343"}</code>
Modified again
<code> data: { x: '12' , y: '34' }</code>
Compile, clear cache, restart
Return
<code>1234</code>
What is this situation?
<code>wx.request({ url: 'wxapp.php', data: { x: '12', y: '34', _: (new Date()).getTime() //加个随机参数 }, header: { 'Content-Type': 'application/json' }, success: function(res) { console.log(res.data) } });</code>