【发布时间】:2013-04-21 23:53:34
【问题描述】:
当我访问我的页面时,我得到一个空白显示和以下消息:
"未声明 HTML 文档的字符编码。如果文档包含 US-ASCII 范围之外的字符,则在某些浏览器配置中,文档将呈现乱码。页面的字符编码必须在文档或传输协议中。”
以下是相关代码:
<?php
$errors = array();
$missing = array();
//check if the form has been submitted
if (isset($_POST['send']))
{
//email processing script
$to = '$_POST['email']';
$subject = 'Your Quote';
$expected = array('email',);
$required = array('email');
$headers .= 'Content-Type: text/plain; charset=utf-8';
require('./includes/processmail.inc.php');
if ($mailSent) {
header('Location: http://www.dailyspiro.com/email.php');
exit;
}
}
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
【问题讨论】:
-
1) 使您的代码更具可读性。它将帮助您追踪错误。 2)您遇到的错误与您的 PHP 代码无关,而是您在 meta.xml 中设置的字符编码。 3)还有更多代码吗?如果不是,您没有告诉页面显示任何内容,使用您的 PHP 或 HTML。
-
你是从哪个浏览器得到这个错误的?