清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
function random_password($length, $characters='abcdefgh1234567890'){ if ($characters == ''){ return ''; } $chars_length = strlen($characters)-1; mt_srand((double)microtime()*1000000); $pwd = ''; while(strlen($pwd) < $length){ $rand_char = mt_rand(0, $chars_length); $pwd .= $characters[$rand_char]; } return $pwd; } //使用范例 random_password(5,'abcd1234') => returns something like: '2b4d3'