从MySQL进行SELECT时缺少HTML标记(Codeigniter) [英] HTML tags missing when SELECT from MySQL (Codeigniter)

查看:52
本文介绍了从MySQL进行SELECT时缺少HTML标记(Codeigniter)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Codeigniter与MySQL数据库一起使用。脚本要做的是,它需要一些包含HTML标记的HTML代码,将它们插入数据库中,然后稍后再检索HTML代码。

I am using Codeigniter with MySQL database. What the script does is it takes some HTML code containing the HTML tags, insert them into the database and then retrieves the HTML code later in time.

问题: 我注意到,除了< br />

在代码获取,将代码从控制器传递到模型以及模型将HTML代码插入MySQL表列之间的过程中,Codeigniter / MySQL是否删除了HTML标签?我该如何防止它仅针对这种特定情况删除HTML标签?

Is Codeigniter/MySQL removing the HTML tags somewhere between retrieving the code, passing it from controller to model, and the model inserting the HTML code into a MySQL table column? How can I prevent it from removing HTML tags for just this specific situation?

推荐答案

这听起来像是通过


文本编辑器插入style = anything的分配,而xss_clean()
方法将删除这些内容。对编辑器内容使用html净化器,对所有其他字段使用
xss_clean()。

Text editors insert allot of style="anything" and the xss_clean() method will strip those. Use html purifier for your editor content and xss_clean() for all the other fields.

来源: http://codeigniter.com/forums/viewthread/196303/

这篇关于从MySQL进行SELECT时缺少HTML标记(Codeigniter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆