生成随机字符串32位

function createNonceStr($len = 16){
    $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
    $noncestr = '';
    for($i = 0; $i < $len; $i++){
        $noncestr .= $str[rand(0,strlen($str) - 1)];
    }
    return $noncestr;
}

猜你喜欢

转载自blog.csdn.net/dw5235/article/details/106359830