http://www.dewen.org/q/274/php+hash%E7%AE%97%E6%B3%95%E4%BD%BF%E7%94%A8
<?php
function getHash(&$keyword,$n)
{
$hash = crc32($keyword) >> 16 & 0xffff;
return sprintf("%02s",$hash % $n);
}
$table = 'userinfo_'.getHash($username,100);
$sql = "insert into {$table} values(....)";
$db = new models($table);//封装的数据库操作类
$db->MyInsert($sql);
?>
<?php
//范围:00-63
function crc_hash(&$keyword,$n=64)
{
$hash = crc32($keyword) >> 16 & 0xffff;
return sprintf("%02s",$hash % $n);
}
?>