PHP随机字符串,随机密码

function get_rand($length){ 
$chars= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 
srand((double)microtime()*1000000); 
$randStr = "";
for($i=0; $i<$length; $i++) { 
$index = rand()%strlen($chars);
$randStr.= $chars[$index]; 
} 
return $randStr; 
} 
发布了10 篇原创文章 · 获赞 1 · 访问量 5222

猜你喜欢

转载自blog.csdn.net/qq_27702329/article/details/104840901