几个常出现的问题:
1.网站打开空白
2.页面头部出现多余的空白
3.网站出现乱码,如“锘?”
4.后台登录验证码不显示
解决方案:
【一键去除网页BOM属性「解决乱码,头部空白,验证码不显示问题」】1.选用专业的编辑器,例如notepad++,sublime,editplus这样不会自动签名 。
2.sublime通过如下操作File -> Save with Encoding -> UTF-8保存后即可去除bom
3.notepad++选中格式 -> 以UTF-8格式编码 选项即可去除
4.用如下方法可一次性清理网页所有文本文件的bom
复制下面代码
<?php$dir=dirname(__FILE__);if(isset($_GET["act"]) && $_GET["act"] == "del" ){//Del the file!!$filename=basename($_SERVER['PHP_SELF']);@unlink($filename);exit('Error:File Not Found!');}echo "The document:".$dir."<a href=https://www.isolves.com/it/cxkf/qd/2022-11-25/"?act=del" >[Del the delbom.php file]复制上面的代码
";if (!is_dir($dir))die("$dir not exists");$auto = 1;checkdir($dir);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")."
n";}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 (" BOM found, automatically removed.n");} else {return ("BOM found.n");}}else return ("BOM Not Found.n");}function rewrite ($filename, $data) {$filenum = fopen($filename, "w");flock($filenum, LOCK_EX);fwrite($filenum, $data);fclose($filenum);}?>
使用方法:复制上面代码到一个新建的delbom.php(用记事本或者是文本编辑器打开此文件)的文件中,上传到网站根目录,然后访问您的站点,比如http://www.**.com/delbom.php 即可清理所有网页中存在的bom便签 。
推荐阅读
- 安卓开发Android6+权限申请管理用户拒绝权限一键解决方案
- 怎样去除一岁宝宝房间的尿骚味
- 一键5秒智能AI抠图,效果堪比PS大哥!
- 网页视频看不了怎么办 网页视频看不了
- 淘宝网页显示不正常,其它网站正常显示 淘宝网页显示不正常
- 女生长胡子怎么办 女孩子怎么去除小胡子
- 脂肪痘怎么可以去除?
- 家具异味怎么去除最快 家具异味
- 怎么去除冰箱异味,小妙招 怎么去除冰箱异味
- 去除皱纹最有效的几个小妙招有哪些? 面部除皱的好方法
