版权声明:版权归 千龙(dev.21ds.cn) 所有 https://blog.csdn.net/u011368009/article/details/82813252
使用ueditor时,从数据库获取到html数据后,直接在ueditor里显示为代码,可通过以下方式修复:
<textarea id="editor" name="content" style="width:800px;height:400px;" ></textarea >
<input type="hidden" name="" value="{$linfo.content|stripslashes|htmlspecialchars_decode}" id="editorValue">
javascript代码为:
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('editor');
var htmlStr = $("#editorValue").val();
ue.ready(function() {
ue.setContent(htmlStr, false);
});
</script>