接口还回的数据自动在头部加上了BOM头,致使json_decode()转换失败.

 

$html = file_get_contents($url);
$html = str_replace(' ','',$html);
$userInfo = json_decode($html,true);html

缘由:接口还回的数据自动在头部加上了BOM头,致使转换失败。
解决方案:$html = str_replace(' ','',$html);json

相关文章
相关标签/搜索