Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter保存HTML数据,实体问题_Php_Html_Database_Codeigniter_Entities - Fatal编程技术网

Php Codeigniter保存HTML数据,实体问题

Php Codeigniter保存HTML数据,实体问题,php,html,database,codeigniter,entities,Php,Html,Database,Codeigniter,Entities,我使用codeignitier,我想将一些html代码(模板)保存到数据库中 问题是每次实体保存到数据库中时,我都会得到。 我有这个<;发布文本字段时,内容不是,而是采用ASCII编码进行传输。这就是你在数据中看到的。 在存储到数据之前在服务器上进行反编码,或者在检索之后在客户端进行dencode。我建议您在服务器上执行这些操作,因为您需要防止XSS和SQL注入(因为您正在执行的操作可能非常危险)。使用验证库 $this->ci->form_validation->set_

我使用codeignitier,我想将一些html代码(模板)保存到数据库中

问题是每次实体保存到数据库中时,我都会得到。
我有这个<;发布文本字段时,内容不是,而是采用ASCII编码进行传输。这就是你在数据中看到的。 在存储到数据之前在服务器上进行反编码,或者在检索之后在客户端进行dencode。我建议您在服务器上执行这些操作,因为您需要防止XSS和SQL注入(因为您正在执行的操作可能非常危险)。使用验证库

$this->ci->form_validation->set_rules('html_text', 'HTML text', 'htmlspecialchars');           
$html_text   = $this->ci->input->post('html_text',true);