注意array_rand随机返回的是KEY值的集合
<?php srand((float) microtime() * 10000000); $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand($input, 2); print $input[$rand_keys[0]] . "\n"; print $input[$rand_keys[1]] . "\n"; ?>
时间: 2024-10-28 11:56:54