PHP json_decode函数详细解析_PHP

WBOY
Release: 2016-06-01 11:55:50
Original
927 people have browsed it

JSON

一、函数简介
1、此函数有四个参数,一般在使用时会用到前两个,具体的参数可以看手册。

2、第一个参数是json格式的字符串,第二个参数是boolean值(false转化成对象,true转化成数组,默认false),如果转化失败返回null。

二、遇到的问题
在项目中调用了java写的一个web服务,返回的数据是"{'stauts':'1','message':'充值成功'}"。

程序接到后用json_decode把结果转化成数组,但转化的结果是null,太奇怪了。

看了一下手册,在手册中发现了下面的说明,一下就明白了。


把返回的结果改成'{"stauts":"1","message":"充值成功"}'再转化数组就OK了。

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!