<tfoot id='Lu1Ne'></tfoot>
        <bdo id='Lu1Ne'></bdo><ul id='Lu1Ne'></ul>
      <i id='Lu1Ne'><tr id='Lu1Ne'><dt id='Lu1Ne'><q id='Lu1Ne'><span id='Lu1Ne'><b id='Lu1Ne'><form id='Lu1Ne'><ins id='Lu1Ne'></ins><ul id='Lu1Ne'></ul><sub id='Lu1Ne'></sub></form><legend id='Lu1Ne'></legend><bdo id='Lu1Ne'><pre id='Lu1Ne'><center id='Lu1Ne'></center></pre></bdo></b><th id='Lu1Ne'></th></span></q></dt></tr></i><div id='Lu1Ne'><tfoot id='Lu1Ne'></tfoot><dl id='Lu1Ne'><fieldset id='Lu1Ne'></fieldset></dl></div>
      1. <legend id='Lu1Ne'><style id='Lu1Ne'><dir id='Lu1Ne'><q id='Lu1Ne'></q></dir></style></legend>

        <small id='Lu1Ne'></small><noframes id='Lu1Ne'>

      2. 未在 html 文档中声明的字符编码

        时间:2023-10-03
      3. <small id='Oehu4'></small><noframes id='Oehu4'>

              <bdo id='Oehu4'></bdo><ul id='Oehu4'></ul>
            • <i id='Oehu4'><tr id='Oehu4'><dt id='Oehu4'><q id='Oehu4'><span id='Oehu4'><b id='Oehu4'><form id='Oehu4'><ins id='Oehu4'></ins><ul id='Oehu4'></ul><sub id='Oehu4'></sub></form><legend id='Oehu4'></legend><bdo id='Oehu4'><pre id='Oehu4'><center id='Oehu4'></center></pre></bdo></b><th id='Oehu4'></th></span></q></dt></tr></i><div id='Oehu4'><tfoot id='Oehu4'></tfoot><dl id='Oehu4'><fieldset id='Oehu4'></fieldset></dl></div>
                  <tfoot id='Oehu4'></tfoot><legend id='Oehu4'><style id='Oehu4'><dir id='Oehu4'><q id='Oehu4'></q></dir></style></legend>
                    <tbody id='Oehu4'></tbody>
                  本文介绍了未在 html 文档中声明的字符编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个文件,我遇到了一个非常奇怪的错误.错误是:

                  I have a file that I am getting a very weird error on. The error is:

                  The character encoding of the HTML document was not declared. 
                  The document will render with garbled text in some browser configurations if 
                  the document contains characters from outside the US-ASCII range. 
                  The character encoding of the page must to be declared in the document or 
                  in the transfer protocol.
                  

                  它来自的文件是(indexmws.php):

                  the file this comes from is (indexmws.php):

                  session_start();
                  if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true){
                  header('Location: loginmws.php');
                  }
                  
                  include_once('db.php');
                  include_once('amazonmws.php');
                  include_once('decidemws.php');
                  include_once('author.php');
                  include_once('amazonPricingMWS.php');
                  
                  ?>
                  
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  
                  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                  <head>
                      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
                      <title>Decision Maker</title>
                  

                  这是一个不会抛出错误的文件 (index.php) 的完全副本,除了添加 amazonPricingMWS.php 并重定向到标题中带有 mws.php 的页面:

                  This is an exact duplicate of a file that does not throw the error (index.php)with the exception of adding amazonPricingMWS.php and redirecting to pages with mws.php in the title:

                  session_start();
                  if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true){
                  header('Location: login.php');
                  }
                  
                  include_once('db.php');
                  include_once('amazon.php');
                  include_once('decide.php');
                  include_once('author.php');
                  
                  ?>
                  
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  
                  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                  <head>
                      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
                      <title>Decision Maker</title>
                  

                  谁能向我解释为什么我在 indexmws.php 中收到此错误?

                  can anyone explain to me why I am getting this error in indexmws.php?

                  推荐答案

                  出现错误是因为浏览器需要文件的前 1024 个字节的编码格式.可能是第一种情况下包含文件输出了一些内容.

                  The error is coming because the browsers expect the encoding format in the first 1024 bytes of the file. It may be the case that there is some content being outputted by the included files in the first case.

                  浏览器现在缓冲文件的前 1024 个字节以检查字符编码.如果在前 1024 个字节中未遇到编码描述,则显示此警告.

                  The browsers now buffer the first 1024 bytes of the file to check for the character encoding. If the encoding description is not encountered in the first 1024 bytes, this warning is displayed.

                  在您的情况下,您可以使用 php 标头在包含其他文件之前指定内容类型:

                  In your case, you can use a php header for specifying the content type before the other files are included:

                  header('Content-type: text/html; charset=utf-8');
                  

                  欲了解更多信息,请阅读:http://gtmetrix.com/specify-a-character-set-early.html

                  For more information, read this: http://gtmetrix.com/specify-a-character-set-early.html

                  这篇关于未在 html 文档中声明的字符编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP 邮件编码主题行 下一篇:在 php 中将 UTF-16LE 转换为 UTF-8

                  相关文章

                  最新文章

                    • <bdo id='upDor'></bdo><ul id='upDor'></ul>
                  1. <i id='upDor'><tr id='upDor'><dt id='upDor'><q id='upDor'><span id='upDor'><b id='upDor'><form id='upDor'><ins id='upDor'></ins><ul id='upDor'></ul><sub id='upDor'></sub></form><legend id='upDor'></legend><bdo id='upDor'><pre id='upDor'><center id='upDor'></center></pre></bdo></b><th id='upDor'></th></span></q></dt></tr></i><div id='upDor'><tfoot id='upDor'></tfoot><dl id='upDor'><fieldset id='upDor'></fieldset></dl></div>

                      <tfoot id='upDor'></tfoot>
                      <legend id='upDor'><style id='upDor'><dir id='upDor'><q id='upDor'></q></dir></style></legend>

                      <small id='upDor'></small><noframes id='upDor'>