使用 tinymce 编辑器时,我的数据没有发布到数据库中

My data does not get posted in the database when using tinymce editor

我真的需要帮助,因为这实际上是我第一次在网站上使用所见即所得的编辑器。 这是文本区域的代码:<textarea title="news" id="news" name="news" class="form-control col-md-7 col-xs-12"></textarea> 和 tinymce 集成的代码:

<script>
        tinymce.init({
            selector: '#news',
            browser_spellcheck: true,
            branding: false,
            height: 400,
            menu: {
                file: {title: 'File', items: 'newdocument'},
                edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'},
                insert: {title: 'Insert', items: 'link media | template hr'},
                view: {title: 'View', items: 'visualaid'},
                format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
                table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
                tools: {title: 'Tools', items: 'spellchecker code'}
            },
            menubar: 'file edit insert view format table tools help',
            toolbar: ['undo', 'redo','searchreplace', 'preview'],
            plugins: [ 'code', 'lists', 'autolink', 'preview', 'searchreplace', 'wordcount'],
            encoding: 'xml'
        });
    </script>

我现在的问题是,当我尝试将值插入数据库时​​,它第一次插入但没有插入连续的值。这是我的插入代码:

$ins->insert('headline', array('id'=>'','post_id'=>$pi_id,'post_cat'=>$cat,'post_title'=>$title,'post_cont'=>$content));

我还允许 $content 是 textarea 的值通过一些功能,如 striptags 和 htmlentities,我在提交后打印出 $content 的值,并将其显示在 xml 中,我不这样做看成一个问题。我遇到的唯一问题是它在第一次提交后不会在数据库中显示连续数据。谢谢

我想我会自己回复这个问题,我犯了一个非常愚蠢的错误,我发现撇号导致了错误。我结束了使用 bindParam 来解决这个问题。您也可以为此使用 addslashes() 函数。