获取随机的字符串

// 获取随机的字符串
function get_rand_char($length = 6) {
    $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
    $strLength = 61;
    
    for($i = 0; $i < $length; $i ++) {
        $res .= $str [rand ( 0, $strLength )];
    }
    
    return $res;
}

 

posted @ 2017-12-27 15:45  不一样的开始  阅读(117)  评论(0编辑  收藏  举报