Home>Article>Web Front-end> Detailed explanation of the solution to the blank issue in json_decode

Detailed explanation of the solution to the blank issue in json_decode

coldplay.xixi
coldplay.xixi forward
2020-06-12 18:22:34 3117browse

Detailed explanation of the solution to the blank issue in json_decode

Solution to the blank issue in json_decode

In fact, I also found this problem online

In fact, this reason is mainly due to the encoding of the returned data, or it may be due to the fact that the interface file contains a BOM. Now let’s cut the nonsense and talk about the solution directly.

Method 1:

$str = 获取json字符串; $info = json_decode(substr($str, 3), true); print_r($info);

Additional:

If we include this "stdClass Object" in the parsed code, we can deal with it according to the following method.

Several methods of converting stdClass Object to array in PHP

Recommended tutorial: "JS Tutorial"

The above is the detailed content of Detailed explanation of the solution to the blank issue in json_decode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:liqingbo.cn. If there is any infringement, please contact admin@php.cn delete