且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

json_decode PHP问题

更新时间:2023-12-04 14:37:17

是否可能是您周围有一些html标记,在执行简单的echo时看不到?

Could it be that you have some html tags around it that you don't see when doing the simple echo?

尝试:echo htmlentities((string)$results);查看更多内容,或检查页面的html源.

Try: echo htmlentities((string)$results); to see more, or check the html source of the page.

如果json_decode()失败,则表明该字符串不是标准JSON.

If json_decode() fails, it means the string isn't standard JSON.

您还可以使用 json_last_error_msg()找出为什么它返回NULL的原因.如果json_decode中有任何错误,则会返回一条错误消息.

You can also use json_last_error_msg() to figure out why it returned NULL. That will return an error message if there was any error in json_decode.