代码如下 :
//建立有76个字符组成的字典
$pattern='1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM!@#$%^&*()_+?.,';
//通过for循环进行随机挑选出10位数 for($i=0;$i<10;$i++){ $key.=$pattern{mt_rand(0,76)}; }