您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php 生成随机函数

2026/1/10 16:00:41发布19次查看
php 生成随机函数
function genrandomstring($len)
{
        $chars = array(
        a, b, c, d, e, f, g, h, i, j, k,
        l, m, n, o, p, q, r, s, t, u, v,
        w, x, y, z, a, b, c, d, e, f, g,
        h, i, j, k, l, m, n, o, p, q, r,
        s, t, u, v, w, x, y, z, 0, 1, 2,
        3, 4, 5, 6, 7, 8, 9
        );
        $charslen = count($chars) - 1;
        shuffle($chars);
        $output = ;
        for ($i=0; $i        {
            $output .= $chars[mt_rand(0, $charslen)];
        }
        return $output;
}
还有一种是php 自带的mt_rand 与rand 哦,不过建意最好用mt_rand这个事速度上优与rand
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product