字体大小未保存在数据库中 - ckeditor

Font Size is not saving in DB - ckeditor

我正在使用完整的 ckeditor 包,我在这两天遇到了一个奇怪的问题。一切正常,但 font-size 根本不工作。当我 select 一行并更改它的字体大小时,它在源代码模式下显示正确的代码:

<span style="font-size:9px">My selected line</span> 

但是当我将此结果保存在数据库中时,它会将此行转换为如下所示。

<span xss=removed> My selected line</span>

我正在使用 CodeIgniter,在保存数据之前没有使用任何特殊功能。仅使用 CI.

post 函数

似乎 codeigniter 可以清除您的 html 以抵御 XSS 攻击。

慎用:

$this->input->post('html', false);

第二个参数将禁用 XSS 过滤器。

  $this->input->post($ck_editor_contents, false);

这个禁用 post 过滤并将所有内容保存到数据库。

$this->input->post($ck_editor_contents, false); 并在数据插入和更新情况下删除 link 以下 $posted_data = $this->security->xss_clean($posted_data)

你也可以用其他方法编辑内容 $where = "products_id = '".$res['products_id']."'"; $posted_data2 = array('products_description'=>$this->input-post('products_description',false)); $this->product_model->safe_update('wl_products',$posted_data2,$where,FALSE); Source