PHP另类方法 生成随机字符串
1function getRandStr($n=6){ 2 $str = ""; 3 for( $i=0; $i<$n; $i++ ){ 4 $case = rand(0, 2); 5 switch($case){ 6 case 0: 7 /* ASCII 97-122 a-z */ 8 $str .= chr(rand(97, 122)) ; 9 break; 10 case 1: 11 /* ASCII 65-90 A-Z */ 12 $str .= chr(rand(65, 90)) ; 13 break; 14 case 2: 15 /* ASCII 48-57 0-9 */ 16 $str .= chr(rand(48, 57)) ; 17 break;...