且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP语言问题

更新时间:2023-02-26 13:40:16

将消息编码为UTF-8 (请参阅 utf8_encode() ,并添加以下标题:

Encode your message as UTF-8 (see utf8_encode()) and prepend the following header:

$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');