一个产生随机密码的php函数

<?php
function MakePass($length) {

$possible = "0123456789!@#$%^&*()_+" .

"abcdefghijklmnopqrstuvwxyz" .

"ABCDEFGHIJKLMNOPQRSTUVWXYZ";

$str = "";

while (strlen($str) < $length) {

$str .= substr($possible, (rand() % strlen($possible)), 1);

}

return ($str);

}
echo MakePass(5);
?>

你可能感兴趣的:(PHP)