开发者

how to change the html tags into html entities using PHP

This is a simple question. I am using the libmail class to send my mails. For composing the mails I am using the CKEditor. My problem is that when I send the mail to someone the mail is displaying like this:

<p><span style="color: rgb(255, 160, 122);">data</span></p>
开发者_如何学C

I already tried this:

$message = htmlspecialchars(stripslashes($message));

And:

$message =  htmlentities($message);

Still it does the same thing.


Try html_entity_decode http://php.net/manual/en/function.html-entity-decode.php


Looking at that class, I see a Html method. So if you want to add HTML with charset UTF-8, use:

$mail = new Mail;
$mail->To('receiver@example.com');
$mail->Html('<b>boldfaced</b>', 'UTF-8');
$mail->Send();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜