您的位置:首页 > 其它

生成随机的6位或指定位可见字符串

2012-08-20 13:48 211 查看
function readable_random_string($length = 6){ 
    $conso=array("b","c","d","f","g","h","j","k","l", 
    "m","n","p","r","s","t","v","w","x","y","z"); 
    $vocal=array("a","e","i","o","u"); 
    $password=""; 
    srand ((double)microtime()*1000000); 
    $max = $length/2; 
    for($i=1; $i<=$max; $i++) 
    { 
    $password.=$conso[rand(0,19)]; 
    $password.=$vocal[rand(0,4)]; 
    } 
    return $password; 
} 
echo readable_random_string();

生成随机的6位或指定位可见字符串。

可改。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: