In such cases, there is usually BOM head string parsing of 65279 lead, this time as long as the removal of BOM head on the line, wrote a simple analytical method BOM head.
public static function checkBOM(&$str)
{
if (ord(substr($str, 0, 1)) == 239 && ord(substr($str, 1, 1)) == 187 && ord(substr($str, 2, 1)) == 191) {
$str = substr($str, 3);
return true;
}
return false;
}