我的网站在localhost
中运行,没有任何错误;但当我将我的站点添加到CPpanel
并运行members.php
时,页面不显示(它显示白色背景)
在控制台中检查页面显示以下错误消息:
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 be declared in the document or in the transfer protocol.
检查元件仅显示以下行:
<div style="clear:both;"></div>
</div>
</div>
</body>
</html>
根据您得到的错误,请将其添加到您的<head> ... </head>
:中
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">
如果上面的字符集不起作用,请尝试以下操作:
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
我希望你将页面的正文前部分定义为:
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title> Your Title</title>
</HEAD>
<BODY>
....
第2版:
在members.php
中包含其他PHP文件之前,请先键入以下行:
header('Content-type: text/html; charset=utf-8');
你在页眉中有这样的东西吗?您将文件的utf-8编码改为utf-8。
<meta http-equiv="content-type" content="text/html; charset=utf-8" />