php bom去除工具_php批量去除bom的代码[交流qq 158393237] 微信管家不显示验证码 微信管家无法显示验证码
2014-05-14 20:18
609 查看
<?php
if (isset($_GET['dir'])){ //设置文件目录
$basedir=$_GET['dir'];
}else{
$basedir = '.';
}
$auto = 1;
checkdir($basedir);
function checkdir($basedir){
if ($dh = opendir($basedir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..'){
if (!is_dir($basedir."/".$file)) {
echo "filename: $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 found, automatically removed._<a href=http://www.ibmstyle.com>http://www.ibmstyle.com</a></font>");
} else {
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}
function rewrite ($filename, $data) {
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
?>
保存为一个php文件,放到网站根目录下,可以遍历文件夹并自动清除bom,对文件绝对安全,亲测过的,测试用途
php bom去除工具_php批量去除bom的代码 微信管家不显示验证码 微信管家无法显示验证码
if (isset($_GET['dir'])){ //设置文件目录
$basedir=$_GET['dir'];
}else{
$basedir = '.';
}
$auto = 1;
checkdir($basedir);
function checkdir($basedir){
if ($dh = opendir($basedir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..'){
if (!is_dir($basedir."/".$file)) {
echo "filename: $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 found, automatically removed._<a href=http://www.ibmstyle.com>http://www.ibmstyle.com</a></font>");
} else {
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}
function rewrite ($filename, $data) {
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
?>
保存为一个php文件,放到网站根目录下,可以遍历文件夹并自动清除bom,对文件绝对安全,亲测过的,测试用途
php bom去除工具_php批量去除bom的代码 微信管家不显示验证码 微信管家无法显示验证码
相关文章推荐
- PHP批量去除bom头代码的小工具
- PHP批量去除BOM头代码分享
- php 批量检测bom头,去除bom头工具
- PHP批量去除BOM头代码分享
- 批量去除PHP文件中bom的PHP代码
- PHP批量去除PHP文件中bom的代码
- PHP批量去除BOM头内容信息代码
- php批量检测并去除BOM头的代码
- PHP批量去除bom头代码
- 批量去除PHP文件中bom的PHP代码
- Php批量去除bom工具源代码
- php批量去除bom的代码
- PHP批量去除BOM头内容信息代码
- PHP错误处理,无法显示验证码。。无法显示首页等莫名其妙的500
- PHP中 验证码无法在调用页面正常显示
- PHP批量删除、清除UTF-8文件BOM头的代码实例
- 关于php验证码无法显示的问题的自我反思
- PHP生成验证码时“图像因其本身有错无法显示”的解决方法
- PHP文件头BOM带来的困惑(frameset无法显示,头部一行空白)