php安全过滤

不言
不言 原创
2023-03-24 17:52:01 1158浏览

这篇文章介绍的内容是关于php安全过滤 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

安全的过滤函数:

function filter($input){
    $input=strip_tags(trim($input));
    $input=htmlentities($input,ENT_QUOTES,'UTF-8');
    $input=str_ireplace(
        array('\\','script','expression'),
        array('\','script','expression')
    );
    return $input;
}

相关推荐:

浅析php过滤html字符串,防止SQL注入

php array_filter 过滤数组中的空值

以上就是php安全过滤 的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。