Home > Backend Development > PHP Tutorial > A pitfall of php json syntax_error syntax error

A pitfall of php json syntax_error syntax error

WBOY
Release: 2016-07-29 09:08:08
Original
1924 people have browsed it
{"code":100,"data":[{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"},{"id":"9"},{"id":"10"}]}
Copy after login

The above Json is completely legal, but when decoded by the client server (PHP), it becomes null. json_last_error_msg() prompts a syntax error, which is puzzling.

Add ob_clean() before output to clear the cache to solve the problem

The above introduces a pitfall of php json syntax_error syntax error, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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