教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php随机生成字符串与随机读取字符串

php随机生成字符串与随机读取字符串

发布时间:2016-10-28   编辑:jiaochengji.com
教程集为您提供php随机生成字符串与随机读取字符串等资源,欢迎您收藏本站,我们将为您提供最新的php随机生成字符串与随机读取字符串资源

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;
}

function generate_rand($l){
$c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
for($i=0; $i<$l; $i ) {
$rand.= $c[rand()%strlen($c)];
}
return $rand;
}

您可能感兴趣的文章:
php生成随机产生六位数密码的代码
php生成指定位数(长度)的随机字符串
php生成随机字符串(自定义纯数字、纯字母或数字字母混合)
php随机生成4位数字验证码
php生成随机字符串(可指定纯数字、纯字母)
php生成随机数的例子
用PHP生成随机数的函数
php生成随机数字和字母的实例代码
php生成随机字符串的函数
php生成N个不重复的随机数

[关闭]
~ ~