您现在的位置是:首页 > 教程 > dedecms教程dedecms教程

dede验证码不显示的解决方法示例(实测)

穆中管2024-05-25 17:47:58dedecms教程已有7人查阅

导读排除gd2和权限问题后还是不显示那么一定是bom问题 存在于dede utf8版本中用下面的程序 批量处理即可保存为bom.php放于网站根目录 执行一下就可以了

排除gd2和权限问题后还是不显示那么一定是bom问题 存在于dede utf8版本中用下面的程序 批量处理即可
保存为bom.php放于网站根目录 执行一下就可以了
<?php
//remove the utf-8 boms
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.</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);
}
?>

本文标签:

很赞哦! (0)

暂无内容
暂无内容
暂无内容
暂无内容
留言与评论 (共有 0 条评论)
昵称:
匿名发表 登录账号
         
验证码: