本文整理汇总了PHP中UserDB::get_similar_users_from_name方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::get_similar_users_from_name方法的具体用法?PHP UserDB::get_similar_users_from_name怎么用?PHP UserDB::get_similar_users_from_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDB
的用法示例。
在下文中一共展示了UserDB::get_similar_users_from_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_user
<?php
// This script allows for checking for similar user names. May be used
// when testing new algorithms for the similarity check.
require_once 'adodb/adodb.inc.php';
include_once 'libuseful/SqlQuery.class.php5';
include_once 'services/sql_query.class.php';
include_once 'services/userdb.class.php';
include_once 'functions/config.inc.php';
include_once 'objects/user.class.php';
$db =& ADONewConnection(cfg("db_dbn")) or die("FreechForum::FreechForum(): Error: Can't connect." . " Please check username, password and hostname.");
function print_user($user, $needle)
{
echo "Match: " . $user->get_name() . " = " . $user->get_lexical_similarity($needle) . "<br>";
}
$userdb = new UserDB($db);
$needle = new User();
$needle->set_name($_GET['name']);
if ($_GET['name2']) {
$user = new User();
$user->set_name($_GET['name2']);
die("Similarity: " . $user->get_lexical_similarity($needle) . "<br>");
}
$users = $userdb->get_similar_users_from_name($needle->get_name());
foreach ($users as $user) {
print_user($user, $needle);
}
echo "DONE.";