Home > php教程 > php手册 > php 接收 Android 传递的json 转 数组 问题,androidjson

php 接收 Android 传递的json 转 数组 问题,androidjson

WBOY
Release: 2016-06-13 08:38:56
Original
1311 people have browsed it

php 接收 Android 传递的json 转 数组 问题,androidjson

过程:Android  拼接一个 json格式的数据 传值  ,php 接收 转为数组  json_decode   取值

 

json格式为:{"goods":{"100075":{"content":"哈哈"},"53":{"content":"真的吗"},"50":{"content":"是不是"}}}

由于Android  通过 toString 传 会转义 其中的 “”  

{"goods":{"100075":{"content":"哈哈"},"53":{"content":"真的吗"},"50":{"content":"是不是"}}}

 

所以  php 需要  转回去    htmlspecialchars_decode()    这样,得到的再  json_decode 就没问题了。

记得  json_decode($arr,true);  第二个参数为true

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template