php生成不重复随机字符串

2017-05-02 17:51:44

使用时间戳作为原始字符串,再随机生成五个字符随机插入任意位置,生成新的字符串,保证不重复

function myrand($len)
    {
        $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
        $string=time();
        for(;$len>=1;$len--)
        {
            $position=rand()%strlen($chars);
            $position2=rand()%strlen($string);
            $string=substr_replace($string,substr($chars,$position,1),$position2,0);
        }
        return $string;
    }


  • 2021-08-13 23:15:04

    最新iOS APP打包上传到AppStore教程

    作为一名iOS开发者,把辛辛苦苦开发出来的App上传到App Store是件必要的事。但是很多人还是不知道该怎么上传到App Store上,下面就来详细讲解一下具体流程步骤。