Heim >Backend-Entwicklung >PHP-Tutorial >php json syntax_error语法错误的一个坑

php json syntax_error语法错误的一个坑

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:08:081989Durchsuche
{"code":100,"data":[{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"},{"id":"9"},{"id":"10"}]}

上面一段Json完全合法,但是输出到客户服务器(PHP)解码却变成null,json_last_error_msg()提示语法错误,百思不得其解。

在输出前加上ob_clean()清掉缓存解决

以上就介绍了php json syntax_error语法错误的一个坑,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn