0]; protected $searchField = ['cdk_code', 'item_name']; protected $whereField = ['type', 'status']; protected $timeField = ['create_time', 'update_time']; public static function get_production_cdk(int $cdk_num) { $arr = []; while (count($arr) < $cdk_num) { $str = get_rand_str(Config::get('game.cdk.length')); //产生随机数 if (!in_array($str, $arr)) { //判断$arr中是否有$a,有则返回true,否则false $arr[] = $str; } } return $arr; } }