更新时间:2023-02-26 13:40:16
将消息编码为UTF-8 (请参阅 ,并添加以下标题: utf8_encode()
)
Encode your message as UTF-8 (see and prepend the following header:utf8_encode()
)
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/plain; charset=UTF-8' . "\r\n";
// example
mail($to, $subject, $message, $header . $more_headers);
使用 mb_convert_encoding()
将您的邮件转换为utf8,从目前的编码方式:
Use mb_convert_encoding()
to convert your message to utf8, from whatever encoding it's currently on:
$str = mb_convert_encoding($str, 'UTF-8');