PHP htmlentity允许< b>和< i>只要 [英] PHP htmlentities allow <b> and <i> only
本文介绍了PHP htmlentity允许< b>和< i>只要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用htmlentities()
有没有办法我可以设置为仅允许<b>
和<i>
转换为粗体和斜体文本?我知道有一种方法可以做到这一点,但是我已经忘记了.
Using htmlentities()
is there a way I can set to allow only <b>
and <i>
to convert into bold and italic text? I know there was one way of doing this, but i have forgotten.
推荐答案
非常简单
<?php
$string = htmlentities($text);
$string = str_replace(array("<i>", "<b>", "</i>", "</b>"), array("<i>", "<b>", "</i>", "</b>"), $string);
这篇关于PHP htmlentity允许< b>和< i>只要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文