PHP 生成UUID

    public static function  uuid_gen()
    {
        $chars = md5(uniqid(mt_rand(), true));
        $uuid = substr($chars, 0, 8) . '-'
            . substr($chars, 8, 4) . '-'
            . substr($chars, 12, 4) . '-'
            . substr($chars, 16, 4) . '-'
            . substr($chars, 20, 12);
        return $uuid;
    }

赞 (0)

评论区

发表评论

43+6=?

暂无评论,要不来一发?

回到顶部