function trimUTF8BOM($file){
$content = file_get_contents($file);
if(substr($content, 0, 3) == pack(‘CCC‘, 239, 187, 191)) {
$content = substr($content, 3);
file_put_contents($file, $content);
}
return $file;
}
原文:http://www.cnblogs.com/andy2018/p/3853893.html