PHP random string, random password

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; 
} 

 

Published 10 original articles · won praise 1 · views 5222

Guess you like

Origin blog.csdn.net/qq_27702329/article/details/104840901
Recommended