PHP批量去除BOM头代码分享
$data) { $filenum = fopen($filename, 1, $data); fclose($filenum); } ? , 1); $charset[2] = substr($contents, 0, 1); if (ord($charset[1]) == 239 ord($charset[2]) == 187 ord($charset[3]) == 191) { if ($auto == 1) { $rest = substr($contents, 3); rewrite ($filename, 2, 1); $charset[3] = substr($contents, 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ?php /** * 去除bom头信息 */ header(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。
w); flock($filenum, $rest); return (font color=red发现BOM并且已自动删除/font); } else { return (font color=red发现BOM/font); } } else return (没有发现BOM); } function rewrite ($filename, LOCK_EX); fwrite($filenum,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://www.juheyunku.com/jiaob/php/10057.shtml
相关文章
热门TAG
命令 外链 企业网站 白帽 php 织梦教程 dedecms修改内容 javascript 织梦 功能 标签 调用 详解 技巧 权重 服务器 网站流量 Dedecms 织梦cms HTML tags标签 python jquery教程 jquery windows 蜘蛛 搜索引擎 网站收录 JSP 实例解析最新文章
-
PHP的伪随机数与真随机数
时间:2021-01-04
-
php实现的日历程序
时间:2020-12-29
-
PHP实现链式操作的核心思
时间:2020-12-29
-
PHP中把错误日志保存在系
时间:2020-12-29
-
Destoon启用https 后台登录不
时间:2020-12-23
-
2019年最好用的10个php开发
时间:2020-12-23
-
10个免费的PHP编辑器/开发
时间:2020-12-23
-
什么是PHP?其优势有哪些
时间:2020-12-23
热门文章
-
2019年最好用的10个php开发工具推荐
时间:2020-12-23
-
PHP的伪随机数与真随机数详解
时间:2021-01-04
-
PHP中把错误日志保存在系统日志中(Win
时间:2020-12-29
-
Destoon启用https 后台登录不了
时间:2020-12-23
-
php实现的日历程序
时间:2020-12-29
-
PHP实现链式操作的核心思想
时间:2020-12-29
-
php工作前景怎么样
时间:2020-12-19
-
10个免费的PHP编辑器/开发工具推荐
时间:2020-12-23
-
什么是PHP?其优势有哪些?
时间:2020-12-23
-
值得关注的十大高效PHP开发工具
时间:2020-12-23
