huang145632 发表于 2011-2-8 05:37:43

新手求助输入类xss_clean

本帖最后由 huang145632 于 2011-2-8 05:41 编辑

$this->load->helper('security');
$a = '<img src="http://g.cn" onerror=alert("载入图片错误!")>';
echo $this->security->xss_clean($a);
不知道这段代码为啥会报错

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:Undefined property: Student::$security</p>
<p>Filename: controllers/student.php</p>
<p>Line Number: 23</p>

</div><br />
<b>Fatal error</b>:Call to a member function xss_clean() on a non-object in <b>C:\www\application\controllers\student.php</b> on line <b>23</b><br />

suxiaolu 发表于 2011-2-8 13:30:57


echo $this->security->xss_clean($a);


改成


echo xss_clean($a);

jeongee 发表于 2011-2-8 17:52:14

helper不是class,是一个一个的函数

huang145632 发表于 2011-2-8 18:01:22

回复 2# suxiaolu


    谢谢,不过依然不行。

huang145632 发表于 2011-2-8 18:07:01

回复 3# jeongee


    谢谢,能给个实例吗?

Hex 发表于 2011-2-8 23:04:48

参考 http://codeigniter.org.cn/user_guide/helpers/security_helper.html
页: [1]
查看完整版本: 新手求助输入类xss_clean