标签: php
可能重复: Generating (pseudo)random alpha-numeric strings
如何在PHP中生成随机字符串?数字不是问题,但如何处理字母有效?
答案 0 :(得分:0)
您可能最好将正常随机函数与chr结合使用 来自php手册评论:http://php.net/manual/en/function.chr.php
chr
<?php for($i=0; $i<7; $i++){ $random_string .= chr(rand(0,25)+65); } echo $random_string; ?>