为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的HTML中会出现;?

为什么我的HTML中会出现;?

阿晨1998 2019-07-12 09:49:59
为什么我的HTML中会出现;?我在Firebug中看到了这个角色.我不知道为什么会这样,我的代码里没有这样的角色。对于Firefox来说,这是可以的,但在IE中,一切都会中断。我甚至不能在谷歌搜索这个角色。我用utf-8编码保存了我的文件而没有bom。
查看完整描述

3 回答

?
森栏

TA贡献1810条经验 获得超5个赞

有争议的人物&#65279是Unicode字符“零宽度无中断空间”(U+FEFF)。可能是通过复制/粘贴将其复制到代码中,而没有意识到这一点。由于它是不可见的,因此很难判断是否使用了显示实际Unicode字符的编辑器。

一种选择是在一个非常基本的文本编辑器中打开文件,这个编辑器不理解Unicode,或者理解它,但是能够使用它们的实际代码显示任何非ascii字符。

一旦找到它,就可以删除它周围的小块文本,并手动重新键入该文本。


查看完整回答
反对 回复 2019-07-12
?
慕沐林林

TA贡献2016条经验 获得超9个赞

试着:

<?php 
// Tell me the root folder path.// You can also try this one// $HOME = $_SERVER["DOCUMENT_ROOT"];
// Or this// dirname(__FILE__)$HOME = dirname(__FILE__);// Is this a Windows host ? If it is, change this line to $WIN = 1;$WIN = 0;
// That's all I need?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " 
d"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>UTF8 BOM FI
NDER and REMOVER</title><style>body { font-size: 10px; font-family: Arial, Helvetica, sans-serif; background: #FFF; color: #000; }.FOUND { 
olor: #F30; font-size: 14px; font-weight: bold; }</style></head><body><?php
$BOMBED = array();RecursiveFolder($HOME);echo '<h2>These files had UTF8 BOM, but i cleaned them:</h2><p class="FOUND">';foreach ($BOMBED as
 $utf) { echo $utf ."<br />\n"; }echo '</p>';// Recursive finderfunction RecursiveFolder($sHOME) {
  global $BOMBED, $WIN;

  $win32 = ($WIN == 1) ? "\\" : "/";

  $folder = dir($sHOME);

  $foundfolders = array();
  while ($file = $folder->read()) {
    if($file != "." and $file != "..") {
      if(filetype($sHOME . $win32 . $file) == "dir"){
        $foundfolders[count($foundfolders)] = $sHOME . $win32 . $file;
      } else {
        $content = file_get_contents($sHOME . $win32 . $file);
        $BOM = SearchBOM($content);
        if ($BOM) {
          $BOMBED[count($BOMBED)] = $sHOME . $win32 . $file;

          // Remove first three chars from the file
          $content = substr($content,3);
          // Write to file 
          file_put_contents($sHOME . $win32 . $file, $content);
        }
      }
    }
  }
  $folder->close();

  if(count($foundfolders) > 0) {
    foreach ($foundfolders as $folder) {
      RecursiveFolder($folder, $win32);
    }
  }}// Searching for BOM in filesfunction SearchBOM($string) { 
    if(substr($string,0,3) == pack("CCC",0xef,0xbb,0xbf)) return true;
    return false; }?></body></html>

将此代码复制到php文件,上传到root并运行它。

有关这方面的更多信息:http:/forum.virtuemart.net/index.php?Topic=98700.0


查看完整回答
反对 回复 2019-07-12
  • 3 回答
  • 0 关注
  • 462 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信