Heim > Backend-Entwicklung > PHP-Tutorial > php json_decode转换返回null

php json_decode转换返回null

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-06 20:34:17
Original
1176 Leute haben es durchsucht

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

回复内容:

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

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

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

php json_decode转换返回null

Verwandte Etiketten:
php
Erklärung dieser Website
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
Aktuelle Ausgaben
PHP-Datenerfassung?
Aus 1970-01-01 08:00:00
0
0
0
PHP-Erweiterung intl
Aus 1970-01-01 08:00:00
0
0
0
Wie man PHP gut lernt
Aus 1970-01-01 08:00:00
0
0
0
Mehrere PHP-Versionen
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage