javascript - ckeditor 实体 html 数据库

标签 javascript php mysql codeigniter ckeditor

我正在将 CKEditor 与 CodeIgniter 一起使用,并且我将编辑器配置为发送 HTML 字符,但标签未正确发送 enter image description here

这是插入数据库的 Controller :

public function create()
{
    $extra = array(
        'return' => "{$this->_route}index/",
        'success_message' => lang("{$this->_language}:submit_success"),
        'failure_message' => lang("{$this->_language}:submit_failure"),
        'title' => lang("{$this->_language}:create"),
    );
    //$this->streams = 'htmlspecialchars',
    $this->streams->cp->entry_form($this->slug_stream, $this->namespace, 'new', null, true, $extra);
}

这是config.js文件中ckeditor的配置

/**
 * @license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.html or http://ckeditor.com/license
 */

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For the complete reference:
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config
    config.entities_latin = false;
    config.forcePasteAsPlainText = false;
    config.fillEmptyBlocks = false;
    config.basicEntities = false;
    config.entities_additional = '#1049';
    config.entities = false;
    config.specialChars = [ '"', '’', [ '&custom;', 'Custom label' ] ];
    config.specialChars = config.specialChars.concat( [ '"', [ '’', 'Custom label' ] ] );
    // The toolbar groups arrangement, optimized for two toolbar rows.
    config.toolbarGroups = [
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'links' },
        { name: 'insert' },
        { name: 'forms' },
        { name: 'tools' },
        { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'others' },
        '/',
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'about' }
    ];

    // Remove some buttons, provided by the standard plugins, which we don't
    // need to have in the Standard(s) toolbar.
    config.removeButtons = 'Underline,Subscript,Superscript';
};

最佳答案

你好,我找到了一个解决方案,即在 View 中呈现它以批准 html_entity_decode,

'description' =>html_entity_decode($item['description'])

关于javascript - ckeditor 实体 html 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49700825/

相关文章:

MySqlDataAdapter.update() 不使用 DataRelation 更新 DataRow

javascript - 以同样的方式随机化两个数组,javascript

javascript - 将数组值移动到另一个特定数组

javascript - 如何在 JQplot 中操作轴的标签?

javascript - Owl Carousel 2 - 标题 div(img 标题和 alt 标签)

php - 如何修复 "Add myBundle to the asseticBundle config"symfony2 异常?

php - WordPress 查询。正确引用页面摘录?

php - 带有php数组的Mysql SELECT语句

php - 使用 DigitalOcean 在 CentOS 7 上安装 laravel 5 时找不到 PDO 驱动程序

mysql - 在 Laravel 5 中使用查询生成器进行复杂查询