|
控制器代码:
function xss(){
$this->load->library("security");
$a="\"onclick=\" alert('xss'); return false;\"";
$data['str']= $this->security->xss_clean($a);
$this->load->view('xss',$data);
}
视图代码:
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>xss</title>
</head>
<body>
<input value="<?php echo $str ?>">
</body>
</html>
难道必须在视图层使用html转义特殊字符,例如htmlspecialchars ? |
|