2

自分のページにアクセスすると、空白の表示と次のメッセージが表示されます。

「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"> 
4

2 に答える 2

2

PHP コードの先頭で次の PHP ヘッダーを使用します。

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

すなわち。

<?php 
header('Content-type: text/html; charset=utf-8');
$errors = array();
$missing = array();
//check if the form has been submitted
if (isset($_POST['send'])) 
{
//email processing script
$to = '$_POST['email']';
于 2013-04-28T04:37:23.137 に答える
-5

メタ タグを使用してエンコーディングを宣言する代わりに、次のような標準の doctype を使用してみてください。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
于 2013-04-28T04:38:26.630 に答える