时间:2021-07-01 10:21:17 帮助过:18人阅读
function getRandStr($len){
$chars = array("0", "1", "2","3", "4", "5", "6", "7", "8", "9"); //换成a-z,A-Z 52种
$charsLen = count($chars) - 1;
shuffle($chars);
$output = "";
for ($i=0; $i<$len; $i++){
$output .= $chars[mt_rand(0, $charsLen)];
}
return $output;
}
?>