1. 云栖社区>
  2. PHP教程>
  3. 正文

创建可读性的随即字符串

作者:用户 来源:互联网 时间:2017-12-01 15:46:01

字符串创建可读性随即

创建可读性的随即字符串 - 摘要: 本文讲的是创建可读性的随即字符串, [PHP]代码 /**************[email protected] - length of random string (must be a multiple of 2)**************/function rea

[PHP]代码


/**************
[email protected] - length of random string (must be a multiple of 2)
**************/
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;
}

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索字符串 , 创建 , 可读性 随即 ,以便于您获取更多的相关知识。