接口還回的數據自動在頭部加上了BOM頭,致使json_decode()轉換失敗.

 

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

緣由:接口還回的數據自動在頭部加上了BOM頭,致使轉換失敗。
解決方案:$html = str_replace(' ','',$html);json

相關文章
相關標籤/搜索