PHP转换html& nbsp;到空间,& GT;到>等等 [英] PHP convert html   to space, > to > etc
本文介绍了PHP转换html& nbsp;到空间,& GT;到>等等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将所有html标记(& nbsp& gt< lt等)转换为文本格式;
我已经尝试
html_entity_decode()
但它会返回吗?如果& nbsp。
解决方案使用
来自PHP文档页面的示例:
htmlspecialchars_decode
code>用htmlspecialchars 。 来自PHP文档页面的示例:
$ str ='< p> this - & amp ; GT; &安培; QUOT;< / p为H.;
echo htmlspecialchars_decode($ str);
//输出:< p> this - > < / p>
I want to convert all html tags(  > < etc) to text format; I have try
html_entity_decode()
but it will return ? if  .
解决方案
Use htmlspecialchars_decode
is the opposite of htmlspecialchars
.
Example from the PHP documentation page:
$str = '<p>this -> "</p>';
echo htmlspecialchars_decode($str);
//Output: <p>this -> "</p>
这篇关于PHP转换html& nbsp;到空间,& GT;到>等等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文