php 随机生成10位字符代码 _爱资料
主页 > 编程资料 > PHP >
发布时间:2015-12-29 作者:网络 阅读:211次
复制代码 代码如下:
function randStr($len)
{
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; // characters to build the password from
$string='';
for(;$len>=1;$len--)
{
$position=rand()%strlen($chars);
$string.=substr($chars,$position,1);
}
return $string;
}
echo randStr(10)."
";


关键字词: