Home > Backend Development > PHP Tutorial > 请问:关于过滤函数的疑问

请问:关于过滤函数的疑问

WBOY
Release: 2016-06-13 12:57:45
Original
999 people have browsed it

请教:关于过滤函数的疑问
大家好:
    关于过滤函数觉得官方资料讲得不是很清楚,特向大家请教一下:
FILTER_SANITIZE_STRING 这个过滤器“去除标签,去除或编码特殊字符”具体是指哪些特殊字符啊?哪些特殊字符是去除的,哪些是编码的?谁有这方面的具体的说明资料吗?
------解决方案--------------------
mysql_real_escape
------解决方案--------------------

引用:
我想对用户的输入进行过滤,1.去除字母、数字和汉字外的其他字符。2.防sql注入。php里面有现成的过滤函数可用吗?

实现了1,就实现了2.
假定你使用的是 utf-8 编码
$text = preg_replace('/\W/u', '', $text);
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