php过滤前端post提交过滤html标签

function filterChars($chars){
    if(is_array($chars)){
        foreach($chars as &$value){
            if(is_string($value)){
                $value = htmlspecialchars($value);
            }
        }
    }else if(is_string($chars)){
        $chars = htmlspecialchars($chars);
    }
    return $chars;
}

  

原文地址:https://www.cnblogs.com/dalaowang/p/14313487.html