CodeIgniter框架过滤HTML危险代码_php实例

WBOY
Release: 2016-06-07 17:19:01
Original
809 people have browsed it

CodeIgniter过滤HTML危险代码的方法其实有好几种,其中最常见的有如下几种:

1.可以选择使用htmlspecialchars()方法过滤。

2.可以将config文件夹下面的config.php文件中的$config['global_xss_filtering'] = FALSE;设置为:

复制代码 代码如下:
$config['global_xss_filtering'] = true;

但是这样设置后会加大服务器的开销的。所以看情况来设置。

3.可以在$this->input->post('content')这样的post里面的第二个参数设置为true:

复制代码 代码如下:
$this->input->post('content',true);

以上三种方法都能实现对数据的简单过滤,具体使用视情况而定。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template