没有合适的资源?快使用搜索试试~ 我知道了~
使用php清除bom示例
需积分: 0 1 下载量 145 浏览量
2020-12-18
20:33:14
上传
评论
收藏 26KB PDF 举报
温馨提示
![preview](https://dl-preview.csdnimg.cn/13723823/0001-7542e92d4907d934880d0e7e316e0142_thumbnail.jpeg)
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
试读
1页
核心代码 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($ch
资源详情
资源评论
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/13723823/bg1.jpg)
使用使用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前连用两个函数,就可以解决…
ob_get_clean();
ob_clean();
header("Content-type: image/jpeg");
附几个好用的BOM检测工具:
BOM检测.zip
您可能感兴趣的文章您可能感兴趣的文章:PHP批量去除BOM头代码分享用PHP去掉文件头的Unicode签名(BOM)方法
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![php](https://img-home.csdnimg.cn/images/20210720083646.png)
![php](https://img-home.csdnimg.cn/images/20210720083646.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![php](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
weixin_38667403
- 粉丝: 2
- 资源: 915
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0