Home > Backend Development > PHP Tutorial > php过滤垃圾留言(评论)功能

php过滤垃圾留言(评论)功能

WBOY
Release: 2016-06-20 13:01:48
Original
1770 people have browsed it

function isValidData($s){<br />	if(preg_match("/([\x{4e00}-\x{9fa5}]|.+)\\1{4,}/u",$s)){<br />		return false;//同字重复5次以上<br />	}elseif(preg_match("/^[0-9a-zA-Z]*$/",$s)){<br />		return false;//全数字,全英文或全数字英文混合的<br />	}elseif(strlen($s)<10){<br />		return false;//输入字符长度过短<br />	}<br />	return true;<br /><p>}</p>
Copy after login

以上垃圾信息过滤功能还是非常简单粗糙的,不过是应急之需。


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