<?php
    function getVerifyCode($num){
        $content = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $content = str_shuffle($content);
        return substr($content,-$num);
    }

    echo getVerifyCode(4);