PHP - 将特殊字符转换为HTML实体 [英] PHP - Convert Special Characters to HTML Entities

查看:321
本文介绍了PHP - 将特殊字符转换为HTML实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 ==& quot; 
& ==& amp; amp;
€==>& euro;
< ==& lt;
....

我该怎么做?谢谢。

解决方案

htmlentities()是您要查找的内容:



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


I have a problem with sending emails. If it contains special characters, it won't send. I want to convert the special characters to HTML entities like this:

" ==> &quot;
& ==> &amp;
€ ==> &euro;
< ==> &lt;
....

How can I do this? Thanks.

解决方案

htmlentities() is what you're looking for:

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

这篇关于PHP - 将特殊字符转换为HTML实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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