生成固定位数的随机数
 
function generate_code($length = 4) {
    $min = pow(10 , ($length - 1));
    $max = pow(10, $length) - 1;
    return rand($min, $max);
}
posted on 2016-08-10 11:50  阳光小白  阅读(1290)  评论(0编辑  收藏  举报