我有一个 php 页面,它将邮件发送到特定电子邮件,其中包含此页面表单中的数据。邮件必须以网站的母语(阿拉伯语)发送,但是当我单击表单上的提交按钮时,收到的邮件一半可读(阿拉伯语),另一部分不可读(符号)。我想知道如何解决这个问题并且能够发送邮件以母语全部可读? (用户输入的符号除外)
Encode your message as UTF-8 (see utf8_encode() http://php.net/manual/en/function.utf8-encode.php) 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);
EDIT:
Use mb_convert_encoding() http://www.php.net/manual/en/function.mb-convert-encoding.php将消息从当前使用的任何编码转换为 utf8:
$str = mb_convert_encoding($str, 'UTF-8');
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)