//存数字数组 $code = array(); while(count($code) < 6){ //产生随机数1-9 $code[] = rand(1,9); //去除数组中的反复元素 $code = array_unique($code); } echo "<pre>"; print_r($code);
//存数字数组 $code = array(); while(count($code) < 6){ //产生随机数1-9 $code[] = rand(1,9); //去除数组中的反复元素 $code = array_unique($code); } echo "<pre>"; print_r($code);