Home > Article > Web Front-end > How to solve the problem of blank space 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 Basic Tutorial"
The above is the detailed content of How to solve the problem of blank space in json_decode. For more information, please follow other related articles on the PHP Chinese website!