PHP - 将特殊字符转换为 HTML 实体

标签 php email encoding

我在发送电子邮件时遇到问题。如果它包含特殊字符,它不会发送。我想将特殊字符转换为 HTML 实体,如下所示:

" ==> "
& ==> &
€ ==> €
< ==> &lt;
....

我该怎么做?谢谢。

最佳答案

htmlentities() 就是你要找的:

http://uk3.php.net/manual/en/function.htmlentities.php

关于PHP - 将特殊字符转换为 HTML 实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4808373/

相关文章:

php - 当 q=<empty> 时,Solr 返回所有结果

c# - 什么 MIME 用于读取 .eml 文件?

email - 通过php邮件功能发送图片

java - Linux - Java/文件编码

android - 使用 ADB 发送消息的编码问题

php - MySQL 查询只抓取一行而不是多行。为什么?

php数组导入mysql

php - Laravel 的友谊系统 : Many to Many relationship

email - 从 PayPal Digital Goods Express Checkout 检索买家/付款人电子邮件

encoding - 冗余编码?