Home > Web Front-end > JS Tutorial > How to solve the problem of blank space in json_decode

How to solve the problem of blank space in json_decode

coldplay.xixi
Release: 2020-06-13 17:33:12
forward
1872 people have browsed it

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);
Copy after login

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!

Related labels:
source:liqingbo.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