【问题标题】:Tinymce formatted content not displayed from databaseTinymce 格式的内容未从数据库中显示
【发布时间】:2016-07-29 18:52:59
【问题描述】:

您好,我在单页中有很多 tinymce 编辑器。当我在tinymce中格式化内容并将其保存到数据库中时。所有标签都保存在mysql中。但是在编辑时,我从数据库中获取数据,但一些 tinymce(不是全部)无法读取标签,并且它显示的内容没有格式化。我的初始化是:

  tinymce.init({
        selector: "textarea", theme: "modern", width: "100%", height: 300,
        plugins: [
        "advlist autolink link image lists charmap print preview hr anchor pagebreak",
        "searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
        "table contextmenu directionality emoticons paste textcolor responsivefilemanager code",
        "paste"
        ],
        paste_retain_style_properties: "all",
        toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
        toolbar2: "| responsivefilemanager | link unlink anchor | image media | forecolor backcolor  | print preview code ",
        image_caption: true,
        image_advtab: true,
        external_filemanager_path: "<?php echo base_url(); ?>" + "tinymce/file_manager/filemanager/",
        filemanager_title: "Responsive Filemanager",
        external_plugins: {"filemanager": "<?php echo base_url(); ?>" + "tinymce/file_manager/filemanager/plugin.min.js"},
        document_base_url : "<?php echo base_url(); ?>",    
          relative_urls : false, 
          remove_script_host : false,
    });

【问题讨论】:

  • 数据保存到数据库时的样子,取回时的样子?
  • 当我保存在数据库中时,我有带有标签的内容,但是当我获取时,我没有看到任何标签只有文本。
  • 您必须对该字段进行一些过滤/清理。
  • 哦..是的。使用了条形标签。谢谢。

标签: javascript php mysql tinymce


【解决方案1】:

必须进行某种过滤或消毒。

从数据库中获取数据后,您可能使用了strip_tags

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-23
    • 1970-01-01
    • 2015-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多