一个特别菜的问题,怎么在PHP后端输出一个数组,让wx.request获取?

小程序 文章 2021-02-07 16:41 316 0 全屏看文

AI助手支持GPT4.0

一个特别菜的问题,怎么在PHP后端输出一个数组,让wx.request获取?A special question, how to output an array in the PHP backend to get wx.request?

一个特别菜的问题,怎么在PHP后端输出一个数组,让wx.request获取?

如图wx.request后获取到的是字符串,服务器PHP页面用的print_r($row)输出的内容,怎么把这个$row以数组的形式输出出来。

期望的返回结果如下图

As shown in the picture wx.request After obtaining the string, the server PHP page with the print_ R ($row) output, how to output this $row in the form of an array. The expected return result is shown in the figure below

回答:

默垂眸:

1.前端处理是JSON.parse()

2.后端怎么处理就不太清楚了

葱:

echo json_encode($row);

溯夜痕:实际返回效果是这样的,依旧还是字符串类型。
zZZ:

JSON格式啊

-EOF-

AI助手支持GPT4.0