本文整理匯總了PHP中UTF8::encode_mimeheader方法的典型用法代碼示例。如果您正苦於以下問題:PHP UTF8::encode_mimeheader方法的具體用法?PHP UTF8::encode_mimeheader怎麽用?PHP UTF8::encode_mimeheader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UTF8
的用法示例。
在下文中一共展示了UTF8::encode_mimeheader方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send_mail
/**
* Send mail
* Replacement for mb_send_mail(), an UTF-8 friendly replacement for mail()
*/
function send_mail($to, $subject, $message, $additional_headers = '', $additional_parameter = '')
{
$subject = UTF8::encode_mimeheader($subject);
$message = chunk_split(base64_encode($message));
$additional_headers = trim($additional_headers);
if ($additional_headers != '') {
$additional_headers .= "\n";
}
$additional_headers .= "Mime-Version: 1.0\n" . "Content-Type: text/plain; charset=UTF-8\n" . "Content-Transfer-Encoding: base64";
if (ini_get('safe_mode')) {
return @mail($to, $subject, $message, $additional_headers);
} else {
return @mail($to, $subject, $message, $additional_headers, $additional_parameter);
}
}
示例2: send_mail
/**
* Send mail
* Replacement for mb_send_mail(), an UTF-8 friendly replacement for mail()
*/
static function send_mail($to, $subject, $message, $additional_headers = '', $additional_parameter = '', $html = false)
{
$subject = UTF8::encode_mimeheader($subject);
$message = chunk_split(base64_encode($message));
$additional_headers = trim($additional_headers);
if ($additional_headers != '') {
$additional_headers .= "\n";
}
$additional_headers .= "Mime-Version: 1.0\n" . "Content-Transfer-Encoding: base64\n";
if ($html) {
$additional_headers .= "Content-Type: text/html; charset=" . LOCAL_CHARSET;
} else {
$additional_headers .= "Content-Type: text/plain; charset=" . LOCAL_CHARSET;
}
if (SAFE_MODE) {
return @mail($to, $subject, $message, $additional_headers);
} else {
return @mail($to, $subject, $message, $additional_headers, $additional_parameter);
}
}