//生成随机六位数,不足六位两边补零 $num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH); 转载于:https://my.oschina.net/u/3964246/blog/2243746