<?php
function rmBOM($string) {
if(substr($string, 0,3) == pack('CCC',0xef,0xbb,0xbf)) {
$string=substr($string, 3);
}
return $string;
}
function rmBOMFile($fileName) {
$fp = fopen($fileName, 'r');
$_content = fread($fp, filesize($fileName));
@fclose($fp);
$_content = rmBOM($_content);
$fp = fopen($fileName, 'w');
fwrite($fp, $_content);
@fclose($fp);
}
rmBOMFile('파일명'); // utf-8 파일에서 BOM 을 제거합니다.
?>