我在字符串中使用了 htmlspecialchars 函数。但是,我不想清理它们;
<b>, <br>, <p> <ul>,<li> bla bla...
示例:Mystring = "<script>.....</script><br><b>test</b><p>aaaa</p>";
我想; =
<script>.....</script>
最佳答案
看看HTML Purifier ,尤其是 whitelist功能。
如果您允许使用 HTML 标记,这可能是最安全的方法。可以查看对比here .
关于php - 如何在 PHP 中删除 Html 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2442228/