Maison >développement back-end >tutoriel php >简短生成随机密码支持特殊字符
function rand_word($num=12){
$re='';
$list="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~0123456789#$%^&";
$list=str_split($list);
$key=array_rand($list,$num);
foreach($key as $value){
$re .= $list[$value];
}
return $re;
}