<?php
//随机生成n位字符串
function rand_str_n($num){
$str = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKOLP1234567890";
$str_length = strlen($str)-1;
$s='';
for ($i = 0; $i < $num; $i++) {
$s .= $str[rand(0, $str_length )];
}
return $s;
}
echo rand_str_n(6);
?>
网友评论