Home > Backend Development > PHP Tutorial > Detailed analysis of PHP json_decode function_PHP tutorial

Detailed analysis of PHP json_decode function_PHP tutorial

WBOY
Release: 2016-07-13 10:25:01
Original
1120 people have browsed it

1. Introduction to the function
1. This function has four parameters. Generally, the first two are used during use. Please refer to the manual for specific parameters.

2. The first parameter is a string in json format, and the second parameter is a boolean value (false is converted into an object, true is converted into an array, and the default is false). If the conversion fails, null is returned.

2. Problems encountered
In the project, a web service written in java was called, and the data returned was "{'stauts':'1', 'message':'Recharge successful'}".

After receiving it, the program uses json_decode to convert the result into an array, but the conversion result is null, which is too strange.

After reading the manual, I found the following instructions in the manual, and I understood it at once.


Change the returned result to '{"stauts":"1","message":"Recharge successful"}' and then convert it into the array and it will be OK.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825241.htmlTechArticle1. Function introduction 1. This function has four parameters. Generally, the first two are used during use. Specific parameters can be found in the manual. 2. The first parameter is a string in json format, and the second parameter...
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