Home > php教程 > PHP源码 > body text

PhP比较字符串相似度

PHP中文网
Release: 2016-05-25 17:09:56
Original
2472 people have browsed it

PhP比较字符串相似度

<?php 
require(&#39;conn.php&#39;);
$sql="select title from content order by id desc limit 20"; //判断标题相似度
$result=mysql_query($sql,$conn);
$cf=0;
while($row=mysql_fetch_array($result)){
similar_text($row[&#39;title&#39;], $title, $percent); //比较相似度 存放于$percent
if($percent>90){$cf=1;break;} //飘易注:相似度高于90% 则判断重复
}
if($cf==1){
echo "<SCRIPT language=JavaScript>alert(&#39;抱歉!禁止发布重复信息!&#39;);";
echo "this.location.href=&#39;vbscript:history.back()&#39;;</SCRIPT>";
mysql_close();
exit();
}
?>
Copy after login

 以上就是PhP比较字符串相似度的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!