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; }
PHP清除文件BOM数据
时间: 2024-10-10 16:05:06
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; }
PHP清除文件BOM数据