为 bootstrap pagedown Textarea Editing 反转 Markdown
Reversing Markdown for bootstrap pagedown Textarea Editing
我正在使用 bootstrap 页面下载编辑器。我能够获取内容并将其保存到数据库中。
我在数据库中保存如下。
<p>cxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
为了编辑,我尝试在 pagedown 编辑器中显示从我的数据库中检索到的内容。显示如下。
<p>cxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
如何将其显示为明文?
为此使用strip_tags()
,
echo strip_tags("your content.");
查看 this,<b></b>
正在那里被删除。
万一,如果你想单独删除段落(p)标签,你可以查看下面的代码。
$tags_to_strip = array("p");
foreach ($tags_to_strip as $tag) {
$txt = preg_replace("/<\/?" . $tag . "(.|\s)*?>/", '', $txt;
}
我正在使用 bootstrap 页面下载编辑器。我能够获取内容并将其保存到数据库中。
我在数据库中保存如下。
<p>cxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
为了编辑,我尝试在 pagedown 编辑器中显示从我的数据库中检索到的内容。显示如下。
<p>cxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
<p>cxcxcxcxcxcxcxcxcxcx</p>
如何将其显示为明文?
为此使用strip_tags()
,
echo strip_tags("your content.");
查看 this,<b></b>
正在那里被删除。
万一,如果你想单独删除段落(p)标签,你可以查看下面的代码。
$tags_to_strip = array("p");
foreach ($tags_to_strip as $tag) {
$txt = preg_replace("/<\/?" . $tag . "(.|\s)*?>/", '', $txt;
}