欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用php清除bom示例

 更新時(shí)間:2014年03月03日 14:54:36   投稿:zxhpj  
本文主要介紹了使用PHP去除文件BOM頭的的示例,需要的朋友可以參考下

核心代碼

function checkBOM ($filename) { 
    global $auto; 
    $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) { 
      if ($auto == 1) { 
       $rest = substr($contents, 3); 
       rewrite ($filename, $rest); 
       return ("<font color=red>BOM found, automatically removed.</font>"); 
      }else { 
       return ("<font color=red>BOM found.</font>"); 
      } 
    }else return ("BOM Not Found."); 
  }

php清除莫明輸出,用于輸出圖片前把前面所有輸出清空

只要在header前連用兩個(gè)函數(shù),就可以解決...

ob_get_clean();
ob_clean();
header("Content-type: image/jpeg");

附幾個(gè)好用的BOM檢測(cè)工具:
BOM檢測(cè).zip

相關(guān)文章

最新評(píng)論