function rand_number ($min, $max) { return sprintf("%0".strlen($max)."d", mt_rand($min,$max)); } 获取一定范围内的随机数字 位数不足补零。