如何在文本区域中允许粗体,下划线和斜体 [英] How to allow bolding, underlining and italics in textarea
本文介绍了如何在文本区域中允许粗体,下划线和斜体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从数据库读取文本时,我当前正在使用 nl2br()
.不幸的是,如果我用来包裹一些文本,或者该文本没有加粗,并且仍显示代码.如何允许某些HTML通过并正确呈现?
I'm currently using nl2br()
when reading text from a database. Unfortunately, if I wrap some text within with or the text doesn't bold it and shows the code still. How do I allow for some html to go through and be rendered correctly?
我目前正在从数据库中获取此信息...
I'm currently getting this outputted from the database...
< b> blah blah text</b>
当我希望它以粗体显示而不是仍然存在的标记时.
when I'd like it to show bold instead of the tags still existing.
例如:
在数据库中,我有一个虚拟帖子来测试数据库是否正常工作.
In the database I have a dummy post to test if the database works.
数据库读取...
Hello and welcome to the forums!
<b>Test</b>
该信息正通过nl2br()读回.
That information is being read back through nl2br() as..
Hello and welcome to the forums!
<b>Test</b>
我希望测试加粗.
推荐答案
您必须在谈论这个: 查看全文