php json_decode转换返回null

php json_decode转换返回null,错误是UTF-8Malformed UTF-8 characters, possibly incorrectly encoded。
我转换的是一个别的服务器返回的json格式的字符串。我用mb_detect_encoding侦测了是utf8编码的。

阅读 3.8k
2 个回答

试试 file_get_contents(); 先抓取服务器返回的内容;在json出来

在 Chrome 里打开接口地址,查看网络请求,可以看到 Reponse 中 Content-Type:text/html;charset=GBK。

图片描述

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题