public function getString($length = 4){
//从ASCII码中获取
$captcha = '';
//随机取:大写、小写、数字
for($i = 0;$i < $length; $i++){
//随机确定是字母还是数字
switch(mt_rand(1,3)){
case 1: //数字:49-57分别代表1-9
...
PHP生成随机码的方法
PHP生成随机码的方法