PHP随机生成字符串

/**

我们提供的服务有:做网站、成都做网站、微信公众号开发、网站优化、网站认证、五台ssl等。为1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的五台网站制作公司

  • 随机生成字符串
    */
    function randCode($length=5,$type=0){
    $arr = array(1 => "0123456789", 2 => "abcdefghijklmnopqrstuvwxyz", 3 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 4 => "~@#$%^&
    (){}[]|");
    if ($type == 0){
    array_pop($arr);
    $string = implode("", $arr);
    }elseif($type == "-1"){
    $string = implode("", $arr);
    }else{
    $string = $arr[$type];
    }
    $count = strlen($string) - 1;
    $code = '';
    for($i = 0; $i < $length; $i++){
    $code .= $string[rand(0, $count)];
    }
    return $code;
    }

标题名称:PHP随机生成字符串
地址分享:http://lszwz.com/article/ieohgc.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款