toArray(); shuffle($aCountry); $i = 1; $aRandCountry = []; foreach ($aCountry as $aCountryRow) { if (in_array($aCountryRow["name"], $aRandCountry)) { continue; } $aRandCountry[] = $aCountryRow["name"]; if ($i >= $iCountryLimit) { break; } else { $i++; } } $aData["country"] = $aRandCountry; $aData["nodeCount"] = $iNodeCount; $aData["speed"] = $iSpeed; $aData["str"] = self::toStr($aData); return $aData; } public static function toStr($randData) { $str = "本次更新共".$randData["nodeCount"]."个可用节点,最高速度".$randData["speed"]."M/S。覆盖".implode("、", $randData["country"])."等多个区域。"; return $str; } }