PHP检查网站上的双重发布

时间:2014-03-23 06:59:30

标签: php

我希望在用户提交一个表单时运行检查,该表单会将新帖子与旧帖子进行一次比较,以避免同一内容的双重(或更多)发布。

我想到了像

这样的东西
if(strtolower($string1) == strtolower($string2))
{
//do this
}

但不确定这对于检查整个网站是否具有唯一ID

的帖子非常有用

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

您可以在PHP中使用similar_text ..

<?php 
$post1 = 'test1'; 
$post2 = 'test2'; 
similar_text($post1, $post2, $percent); 
if(round($percent)>90)
{
  echo "The two posts are 90% similar.. sorry try again. No spamming !";
}