2

在 DB 中,如下所示。

<img src="../../../../assets/images/frontpage/big_tree.jpg" alt="" 
width="516" height="200" />

但是当它在tinyMCE中时,所有的<,>和“都会变成这样的html实体。所以它不会显示在FF中。

&lt;img src=&quot;../../../../assets/images/frontpage/big_tree.jpg&quot; 
alt=&quot;&quot; width=&quot;516&quot; height=&quot;200&quot; /&gt;

我怎样才能避免这个问题?

我有以下 tinyMCE 初始化

tinyMCE.init({
        mode : "textareas",
        /* // if I want to add to a specific area then use this
        mode : "specific_textareas",
        editor_selector : "mceEditor", // add class="mceEditor" where you want to add tinyMCE
        */

        theme : "advanced",
        plugins : "advimage,advlink,media,contextmenu",
        //theme_advanced_buttons1_add_before : "newdocument,separator",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
        theme_advanced_buttons2_add_before: "cut,copy,separator,",
        theme_advanced_buttons3_add_before : "",
        theme_advanced_buttons3_add : "media",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        //extended_valid_elements : "hr[class|width|size|noshade]",
        extended_valid_elements : "span[class|align|style]",
        file_browser_callback : "ajaxfilemanager",
        paste_use_dialog : false,
        theme_advanced_resizing : true,
        theme_advanced_resize_horizontal : true,
        apply_source_formatting : true,
        force_br_newlines : true,
        force_p_newlines : false,   
        relative_urls : true
    });

提前致谢。

4

3 回答 3

2

您需要将tinymce 内容按原样保存在数据库中(“<”和“>”作为真实字符),否则您需要在将数据库内容呈现到网页之前对它们进行实体解码。根据您的脚本语言(perl、php、python、...),有一些特殊的功能可以做到这一点。

于 2012-04-16T07:20:58.860 回答
2

在 php 中,您可以使用html_entity_decode

于 2012-04-14T10:36:44.013 回答
0

我有同样的问题,我通过添加来纠正它

        $_POST = array_map( 'stripslashes', $_POST );
于 2015-12-19T03:35:18.617 回答