Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在我的PHP表单上使用西里尔文有问题_Php_Html - Fatal编程技术网

在我的PHP表单上使用西里尔文有问题

在我的PHP表单上使用西里尔文有问题,php,html,Php,Html,当有人用西里尔文给我发电子邮件时,我收到了一些奇怪的信件。这是我的一部分: HTML代码: <form method="post" action="index.php" id="formaa" accept-charset="UTF-8"> <input name="name" placeholder="Name" id="aa"> <input name="email" type="email" placeholder="E-mail" id="

当有人用西里尔文给我发电子邮件时,我收到了一些奇怪的信件。这是我的一部分:

HTML代码:

<form method="post" action="index.php" id="formaa" accept-charset="UTF-8">

    <input name="name" placeholder="Name" id="aa">
    <input name="email" type="email" placeholder="E-mail" id="aa">      
    <textarea name="message" placeholder="Message"></textarea>      
    <input name="human" placeholder="2+2=" id="ab">
    <input id="submit" name="submit" type="submit" value="Submit">

</form>

PHP(全文):


请更改:

$from = 'From: PappuLighting'; 

和变化:

if (mail ($to, $subject, $body, $from)) { 
致:


替换
$from='from:papplighting'
$headers='From:papplighting'

另外
if(邮件($to,$subject,$body,$from))
to
if(邮件($to,$subject,$body,$headers))

从中检查邮件函数的示例代码
$message=”
HTML电子邮件
此电子邮件包含HTML标记

名字 姓氏 约翰 雌鹿 "; //发送HTML电子邮件时始终设置内容类型 $headers=“MIME版本:1.0”。“\r\n”; $headers.=“内容类型:text/html;字符集=UTF-8”。“\r\n”; //更多标题 $headers.='From:'。“\r\n”; $headers.='Cc:myboss@example.com' . “\r\n”; 邮件($to、$subject、$message、$headers); ?>
您已在$header变量中设置了2个标题,但这些标题未在邮件函数中使用。未做任何更改:/change to:$headers=“MIME Version:1.0”。“\r\n”$标题。=“内容类型:文本/html;字符集=UTF-8”。“\r\n”;那有帮助!非常感谢。
$headers = 'From: PappuLighting'; 
if (mail ($to, $subject, $body, $from)) { 
if (mail ($to, $subject, $body, $headers)) { 
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: <webmaster@example.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";

mail($to,$subject,$message,$headers);
?>