PHP不过过滤防止xss攻击的方法

PHP不过过滤防止xss攻击的方法
<pre>
$content=htmlspecialchars($content);
$pos=strpos($content,"\u");
if(is_numeric($pos)){
echo json_encode(array('success'=>0,'msg'=>'不能出现\u非法字符'));
exit();
}
</pre>
ps:判断\u原因是
<script>
var s = "\u003c\u003e";
alert(s);
</script>
这个也会运行

猜你喜欢

转载自www.cnblogs.com/newmiracle/p/11871504.html