当前位置:Gxlcms > PHP教程 > 请问个json解析有关问题

请问个json解析有关问题

时间:2021-07-01 10:21:17 帮助过:67人阅读

请教个json解析问题
我有几个json串
HTML code
{"clusterno":167145108,"clustertype":1,"subid":"0","newperson":"欢迎【.dazuo.昵称.dayou.】来到群【.dazuo.群名.dayou.】.enter.信息:.enter..dazuo.信息.dayou..enter..dazuo.退群次数.dayou..enter.请改群名片:帮派名┃职位 或者 帮派名┃职位┃昵称.enter.名称不符.douhao.不改名者送去夏威夷...enter..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..jhao..enter.\.douhao.\是机器人.douhao.请直接无视忽略.","removeperson":"","expdatetime":"2021-10-18 23:50:42","userid":"1","username":"admin","updatecode":"7ECEDB4E1037476EAAF5FB5E8340AAEE"}


用json_decode解析会出现是null的.

我测试了 一下,是newperson这个接点太长导致的,有没有什么方法可以解决这个问题

------解决方案--------------------
反斜杠转义,转换编码
PHP code


------解决方案--------------------
utf-8编码文件就不需要再 iconv了.参考楼上的.
------解决方案--------------------
探讨

反斜杠转义,转换编码
PHP code
$json='{"clusterno":167145108,"clustertype":1,"subid":"0","newperson":"欢迎【.dazuo.昵称.dayou.】来到群【.dazuo.群名.dayou.】.enter.信息:.enter..dazuo.信息.dayou..enter..dazuo.退群次数.dayou..……

人气教程排行