json_decode()转数组为null

// 方法一
// chr(239).chr(187).chr(191)组成utf8的bom头
$input= trim($input, chr(239).chr(187).chr(191));

// 方法二
function prepareJSON($input){
    if(substr($input,0,3) == pack("CCC",0xEF,0xBB,0xBF)) $input = substr($input,3);
    return $input;
}

猜你喜欢

转载自my.oschina.net/xiaoerit/blog/1789333