时时商务社区
标题:
PHP 过滤页面中的BOM(实现代码)
[打印本页]
作者:
qz234
时间:
2018-2-14 08:16
[U]复制代码[/U] 代码如下:
function checkBOM ($filename) {
$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) {
$rest = substr($contents, 3);
rewrite $rest;
}else{
return false;
}
}
您可能感兴趣的文章:
php 安全过滤函数代码
PHP 数据结构 算法描述 冒泡排序 bubble sort
php UBB 解析实现代码
php 对输入信息的进行安全过滤的函数代码
php Ubb代码编辑器函数代码
php中数组首字符过滤功能代码
php使用正则过滤js脚本代码实例
php过滤表单提交的html等危险代码
php实现过滤UBB代码的类
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2