我正在存储类似 <ul><li>....</li></ul>
的 html 标签等在表中。我想将这些值检索为 html 内容。当我检索此数据时,我想将其显示为 HTML 内容,也就是说,它应该显示项目符号而不是 <ul><li>....</li></ul>
.
我正在尝试的代码:
<?php echo stripslashes($row3['description'])?>
我什至试过htmlentities()
, html_entity_decode()
但是,没有一个起作用。
最佳答案
您可以使用 htmlspecialchars_decode
函数如下:
echo htmlspecialchars_decode(stripslashes($row3['description']));
代替
echo stripslashes($row3['description']);
你可以在这里了解更多关于功能的信息:http://php.net/manual/en/function.htmlspecialchars-decode.php
关于php - 如何在 PHP 中渲染来自 mysql 数据库的 html 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35218019/