【问题标题】:CK Editor data not save properly in databaseCK Editor 数据未正确保存在数据库中
【发布时间】:2015-06-27 12:02:43
【问题描述】:

我正在使用带有 codeigniter 的 CK 编辑器库。我用 ck 编辑器 textarea 发布数据。数据以如下格式发布:-

  'active' => string '1' (length=1)
  'restaurant_id' => string '60' (length=2)
  'title' => string 'Test' (length=22)
  'details' => string '<p><strong><span style="font-size:48px">This is test.</span></strong></p>' (length=75)

这里的数据是正确发布的。但是当我传入插入方法以将其插入表格时,格式被破坏,我发布:-

这个节目很像

array (size=8)
  'active' => string '1' (length=1)
  'restaurant_id' => string '60' (length=2)
  'title' => string 'Test' (length=22)
  'details' => string '<p><strong><span  is test.</span></strong></p>' (length=46)

如何正确地将数据插入数据库。

【问题讨论】:

  • span 标签是多余的。我建议在strong 标签上应用格式。
  • span 标签由 ckeditor 自动生成。 @Ormoz
  • 如果$_POST变量中的标记是正确的(可以使用print_r($_POST)查出来,那么ckeditor就没有问题。

标签: php codeigniter ckeditor


【解决方案1】:

首先,查看保存到数据库的代码会很有用
但我假设您在 sql 语句中使用双引号?用 single 替换那些应该可以解决问题。
如果问题发生在 POST 上,那么您应该同时显示初始表单和接收 php 脚本。

【讨论】:

    猜你喜欢
    • 2019-12-10
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多