View Single Post
  #1   IP: 218.85.132.244
Old 2008-02-01, 12:02 PM
yahoo yahoo is offline
高级会员
 
Join Date: 2006-04-05
Posts: 165
yahoo 正向着好的方向发展
Default Php随机生成字符串

<?
function MakePass($length)
{
$possible = "0123456789!*#$%^&*()_+".
"abcdefghijklmnopqrstuvwxyz".
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$str = "";
while(strlen($str) < $length)
{
$str .= substr($possible, (rand() % strlen($possible)), 1);
}
return($str);
}
echo $str;
?>
Reply With Quote