Home > Backend Development > PHP Tutorial > php security filtering

php security filtering

不言
Release: 2023-03-24 17:52:01
Original
1688 people have browsed it

这篇文章介绍的内容是关于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;
}
Copy after login

相关推荐:

浅析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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template