php bom去除工具_php批量去除bom的代码[交流qq 158393237] 微信管家不显示验证码 微信管家无法显示验证码
来源:互联网 发布:淘宝怎么弄淘口令 编辑:程序博客网 时间:2024/04/29 16:16
<?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);
}
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的代码 微信管家不显示验证码 微信管家无法显示验证码
0 0
- php bom去除工具_php批量去除bom的代码[交流qq 158393237] 微信管家不显示验证码 微信管家无法显示验证码
- 微信管家不显示验证码的解决方式
- 去除Bom头:thinkPHP中验证码无法显示
- php批量去除bom的代码
- Php批量去除bom工具源代码
- php制作bom批量去除工具
- Php批量去除bom工具源代码
- 去除BOM php代码
- 关于验证码不显示,开了GD库也无法显示的解决方法。清除BOM头
- UTF-8 BOM导致验证码不显示
- 【微信平台】艺萌管家APP技术总结(二)——云片网发送短信验证码
- php 批量去除bom头方法
- PHP批量去除文件头部Bom信息
- PHP去除BOM头
- PHP去除BOM头
- php 去除 BOM头
- Php去除Bom
- PHP去除BOM头
- Binder 进程间的通信---ipc通信
- Collection List Set Map 区别记忆
- c++ 单例
- Android菜鸟在成长-对话选项框2单选和复选
- latex 图表 figure and table 混排
- php bom去除工具_php批量去除bom的代码[交流qq 158393237] 微信管家不显示验证码 微信管家无法显示验证码
- [ios]关于CoreData的一个工具Mogenerator的使用
- Valid Sudoku & Subsets I&&II & Flatten Binary Tree to Linked List & Jump Game I&&II
- Java学习笔记_16_JavaBean
- SQL 列转行/list agg 列超长处理方法
- 漫谈惯性、视觉暂留、潜意识、混合动力发动机、先入为主 - 纯粹的无厘头?
- android json解析及简单例子
- Java 8的元空间
- leetcode 第一刷_Remove Nth Node From End of List