PhP比较字符串相似度
<?php require('conn.php'); $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['title'], $title, $percent); //比较相似度 存放于$percent if($percent>90){$cf=1;break;} //飘易注:相似度高于90% 则判断重复 } if($cf==1){ echo "<SCRIPT language=JavaScript>alert('抱歉!禁止发布重复信息!');"; echo "this.location.href='vbscript:history.back()';</SCRIPT>"; mysql_close(); exit(); } ?>
以上就是PhP比较字符串相似度的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!