DDR爱好者之家 Design By 杰米
<"Content-Type:text/html; charset=utf-8"); 

$auto = 1; 
checkdir("D:\wamp\www\sales"); 
function checkdir($basedir){ 
if ($dh = opendir($basedir)) { 
 while (($file = readdir($dh)) !== false) { 
  if ($file != '.' && $file != '..'){ 
  if (!is_dir($basedir."/".$file)) { 
   echo "文件名称: $basedir/$file ".checkBOM("$basedir/$file")." <br>"; 
  }else{ 
   $dirname = $basedir."/".$file; 
   checkdir($dirname); 
  } 
  } 
 } 
closedir($dh); 
} 
} 
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并且已自动删除</font>"); 
 } else { 
  return ("<font color=red>发现BOM</font>"); 
 } 
} 
else return ("没有发现BOM"); 
} 
function rewrite ($filename, $data) { 
$filenum = fopen($filename, "w"); 
flock($filenum, LOCK_EX); 
fwrite($filenum, $data); 
fclose($filenum); 
} 
?>

DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米