PHP语言问题 [英] PHP language problem

查看:99
本文介绍了PHP语言问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php页面,将邮件发送到特定的电子邮件,其中包含在此页面上的表单中的数据。邮件必须以网站的母语(阿拉伯语)发送,但是当我单击表单上的提交按钮时,邮件被收到一半可读(阿拉伯语),另一部分是不可读的(符号)。我想知道如何解决这个问题,并能够发送邮件,以使所有可读的母语? (用户输入符号除外)

I have a php page that sends mails to a specific email with the data included in the form on this page. The mail has to be sent in the native language of the website (Arabic) but when I click the submit button on the form, the mail is received half readable (Arabic language) and the other part is unreadable (Symbols). I want to know how to solve this problem and be able to send the mail to be all readable in the native language? (except for user-input symbols)

推荐答案

将消息编码为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');

这篇关于PHP语言问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆