判断文件首是否包含BOM头



        header("content-type:text/html;charset=utf-8");
        $url = "http://info.live8bo1.com:90/rjs/2012/0513_score.js?r=0.4787992987028289";
        $html = trim(file_get_contents($url));
        if(ord($html[0])== 239 && ord($html[1])== 187 && ord($html[2]) == 191){
            $html = substr($html,3);
        }
        eval("\$data='$html';");
        echo "<pre>";
        print_r(json_decode($data,true));


你可能感兴趣的:(判断文件首是否包含BOM头)