php随机生成字符串
1
2
3
4
5
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$password = "";
for ( $i = 0; $i < 8; $i++ ){
$password .= $chars[ mt_rand(0, strlen($chars) - 1) ];
}
1
2
3
4
5
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$password = "";
for ( $i = 0; $i < 8; $i++ ){
$password .= $chars[ mt_rand(0, strlen($chars) - 1) ];
}