代码片段 → PHP → 从预定义字符中生成随机字符串 从预定义字符中生成随机字符串 Chris Coyier 于 2009年9月13日 <?php $string = "abcdwxyz456789"; for($i=0;$i<25;$i++){ $pos = rand(0,13); $str .= $string{$pos}; } echo $str; ?>