欢迎来到电脑知识学习网,专业的电脑知识大全学习平台!

手机版

如何制作乱码文件夹-(如何制作乱码文件夹图片)

操作系统 发布时间:2022-12-09 19:51:47
如何制作乱码文件夹 (如何制作乱码文件夹图片)

几个常出现的问题:

1.网站打开空白

2.页面头部出现多余的空白

3.网站出现乱码,如“锘?”

4.后台登录验证码不显示

解决方案:

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=\"?act=del\" >[Del the delbom.php file]</a><BR/>";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")."<BR/>\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 ("<font color=red> BOM found, automatically removed.</font>\n"); } else { return ("<font color=red>BOM found.</font>\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便签。


电脑
责任编辑:电脑知识学习网

操作系统