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

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

WBOY
WBOYOriginal
2016-06-20 13:01:481708browse

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>

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


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