Home >Backend Development >PHP Tutorial >php security filtering

php security filtering

不言
不言Original
2018-04-23 16:18:231686browse

这篇文章介绍的内容是关于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 过滤数组中的空值

The above is the detailed content of php security filtering. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP language structureNext article:PHP language structure