PHP 生成MAC地址

    /**
     * 生成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));
    }

赞 (0)

评论区

评论已关闭

回到顶部