CKEditor在编辑器中显示HTML标签

Pol*_*oRM 2 php ckeditor

我正在使用CKEditor并将内容保存到MySQL数据库.当我尝试在编辑器中再次编辑内容时,我将HTML标记显示为文本,例如:

my test<br />and second line
Run Code Online (Sandbox Code Playgroud)

如何让它再次正确显示在编辑器中?

我一直在摆弄htmlentities和html_entity_decode以及CKEditor相关的设置超过一个小时,但没有用.

   $config = array();
   $config['enterMode'] = 2;
   $config['shiftEnterMode'] = 1;
   //$config['basicEntities'] = FALSE;
   //$config['entities'] = FALSE;
   //$config['entities_greek'] = FALSE;
   //$config['entities_latin'] = FALSE;
   //$config['htmlDecodeOutput'] = TRUE;

   $ck_editor->editor("sec1_content", $default_value, $config);
Run Code Online (Sandbox Code Playgroud)

Den*_* O. 7

CodeIgniter的func似乎在某种程度上set_value()起作用htmlspecialchars().因此,如果您在CKEditor上获得<any_tag>,这种解决方法可以帮助您.更改

$ck_editor->editor("sec1_content", set_value('sec1_content', html_entity_decode($default_value)), $config);
Run Code Online (Sandbox Code Playgroud)

对此:

$ck_editor->editor("sec1_content", html_entity_decode(set_value('sec1_content', $default_value)), $config);
Run Code Online (Sandbox Code Playgroud)

PoloRM
html_entity_decode放在set_value附近.原因很明显,因为set_value方法可能不使用$ default_value参数,而是返回发布的数据.