/** * 过滤用户输入的基本数据,防止script攻击 * * @access public * @return string */ function compile_str($str) { $arr = array(‘<‘ => ‘<‘, ‘>‘ => ‘>‘,‘"‘=>‘”‘,"‘"=>‘’‘); return strtr($str, $arr); }
strtr对用户输入的敏感词汇进行过滤
原文:http://www.cnblogs.com/wanghaokun/p/6104282.html