Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.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
在电子邮件中使用was错误编码发送撇号(';s)是否使用PHP?_Php_Email - Fatal编程技术网

在电子邮件中使用was错误编码发送撇号(';s)是否使用PHP?

在电子邮件中使用was错误编码发送撇号(';s)是否使用PHP?,php,email,Php,Email,在电子邮件消息中发送撇号s(),是否使用was错误编码使用PHP <?PHP include("connect.php"); $to = "example@example.com"; $subject = "TEST SUBJECT"; $message = "peter’s test"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-

在电子邮件消息中发送撇号s(
),是否使用was错误编码使用PHP

<?PHP
include("connect.php");
    $to      = "example@example.com";
    $subject = "TEST SUBJECT";
        $message = "peter’s test";
        $headers  = 'MIME-Version: 1.0' . "\r\n"; 
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'From: EXAMPLE <noreply@example.com>' . "\r\n";
        $headers .= 'Return-Path: return@example.com' . "\r\n";
        mail($to, $subject, $message, $headers, '-freturn@example.com');
?>

当我打开我的电子邮件时,我看到了彼得的™s测试


如何使用php在电子邮件中发送撇号s(
)?

您需要对包含撇号的字符串使用mb\u convert\u编码:

$message = mb_convert_encoding("peter’s test", 'UTF-8');

您正在邮件头中使用字符编码charset=iso-8859-1。我用了utf-8,效果很好。尝试将
charset=iso-8859-1
替换为
charset=utf-8

相关: