/** * 根据随机数生成6位密钥 * author: panzhide * @param boolean $num * @return string * Date: 2020/8/22 */ function getRandKey ($num = false) { if ($num) { $randStr = str_shuffle('1234567890'); return substr($randStr, 0, 6); } else { return substr(md5(mt_rand(0, 32) . '0905' . md5(mt_rand(0, 32)) . '0123'), 10, 6); } }