您的位置:首页 > 编程语言 > PHP开发

PHP 过滤页面中的BOM(实现代码)

2013-06-29 00:00 423 查看
function checkBOM ($filename) {
       $contents = file_get_contents($filename);
       $charset[1] = substr($contents, 0, 1);
       $charset[2] = substr($contents, 1, 1);
      $charset[3] = substr($contents, 2, 1);
      if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {
               $rest = substr($contents, 3);
               rewrite $rest;
      }else{
      return false;
    }
 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: