P

PHP 生成MAC地址

Bejix 代码笔记 2020-03-26
    /**
     * 生成MAC
     */
    public static function mac_gen()
    {
        $array = array(
            mt_rand(0x00, 0x7f),
            mt_rand(0x00, 0x7f),
            mt_rand(0x00, 0x7f),
            mt_rand(0x00, 0x7f),
            mt_rand(0x00, 0xff),
            mt_rand(0x00, 0xff)
        );
        return join(':', array_map(function ($v) {
            return sprintf("%02X", $v);
        }, $array));
    }
PREV
Libvirt 对KVM 网卡镜像 Qos 限速
NEXT
PHP 生成UUID

评论(0)

发布评论