php过滤函数问题

2025-01-01 05:44:30
推荐回答(3个)
回答1:

PHP 的函数 strip_tags()

回答2:

没搞错吧,竟然用这么原始方法,楼主可以把要过滤的东东都放在一个数组里,循环替换下就可以了

回答3:

$str=preg_replace(“select”,"select",$str);
$str=preg_replace(“update”,"update",$str);
$str=preg_replace(“insert”,"insert",$str);
$str=preg_replace(“delete”,"delete",$str);
$str=preg_replace(“or”,"or",$str);
$str=preg_replace(“and”,"and",$str);
$str=preg_replace(“<”,"",$str);
$str=preg_replace(“>”,"",$str);
$str=preg_replace(“*”,"",$str);
$str=preg_replace(“from”,"from",$str);
$str=preg_replace(“join”,"join",$str);
$str=preg_replace(“on”,"on",$str);
$str=preg_replace(“id”,"",$str);
$str=preg_replace(“?”,"",$str);