<html>
<head>
<title></title>
</head>
<body>
<form action="" method="post">
比对帖子的相似度
</br>
字符串1:<input type="text" name="str1">
比字符串2:<input type="text" name="str2">
<input type="submit" value="比较">
</form>
</body>
</html>
<?php
if($_POST){
$a=similar_text($_POST['str1'],$_POST['str2']);
if(strlen($_POST['str1'])>=strlen($_POST['str2'])){
echo "字符串1与字符串2有".$a."个字符相同,相似度为".($a/strlen($_POST['str1'])*100)."%";
}else{
echo "字符串1与字符串2有".$a."个字符相同,相似度为".($a/strlen($_POST['str2'])*100)."%";
}
}
<head>
<title></title>
</head>
<body>
<form action="" method="post">
比对帖子的相似度
</br>
字符串1:<input type="text" name="str1">
比字符串2:<input type="text" name="str2">
<input type="submit" value="比较">
</form>
</body>
</html>
<?php
if($_POST){
$a=similar_text($_POST['str1'],$_POST['str2']);
if(strlen($_POST['str1'])>=strlen($_POST['str2'])){
echo "字符串1与字符串2有".$a."个字符相同,相似度为".($a/strlen($_POST['str1'])*100)."%";
}else{
echo "字符串1与字符串2有".$a."个字符相同,相似度为".($a/strlen($_POST['str2'])*100)."%";
}
}
?>