php - 从数据库读取后,Markitup 总是显示 html 特殊字符

标签 php javascript markitup

在我的数据库中,我存储如下内容:

<p>something</p>

然后我将该值加载到标记编辑器中,但它一直像这样显示

&lt;p&gt;something&lt;/p&gt;

我怎样才能让它显示<p>something</p>在markitupeditor 中?

设置:

// used for the markitup editor
     mySettings = {
        nameSpace:      'html',
        onShiftEnter:   {keepDefault:false, replaceWith:'<br />\n'},
        onCtrlEnter:    {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
        onTab:          {keepDefault:false, replaceWith:'    '},
        markupSet:  [   
            {name:'Heading 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' },
            {name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>'  },
            {name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
            {name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)'  },
            {name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
            {separator:'---------------' },
            {name:'Bulleted List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
            {name:'Numeric List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
            {separator:'---------------' },
            {name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
            {name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
            {separator:'---------------' },
            {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },       
            {name:'Preview', className:'preview',  call:'preview'}
        ]
     }

最佳答案

我的 html 标签被转换为特殊字符的原因是我在 codeigniter form_textarea 函数上设置的参数。

关于php - 从数据库读取后,Markitup 总是显示 html 特殊字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8131965/

相关文章:

php - 如何在 mySQL 中的 EXECUTE 语句之后获取语句的结果?

php - 使用 iconv() 检查无效的 UTF-8 字符 : Detected an illegal character in input string

javascript - 将字符串中的元音替换为 "i"...您能解释一下这个表达式吗? someText.replace(/[aAeEoOuU]/ig ,"i")

javascript - Perl 将值转换为表

jquery - 将 MarkItUp 富文本编辑器预览与 ASP.NET MVC 应用程序集成

php - 如何使用 file_get_contents() 在 Windows NT Auth 之后检索文件

PHP-我如何获取所有 header 的列表

javascript - JS : Making two functions do the same thing

javascript - 清除 MarkItUp 中的文本区域?

jquery - 正则表达式:忽略括号和圆括号之间