我有一个数组:
Array ( [0] => Ahri [1] => Akali [2] => Alistar [3] => Amumu [4] => Anivia [5] => Annie [6] => Ashe [7] => Blitzcrank [8] => Brand [9] => Caitlyn [10] => Cassiopeia [11] => Cho'Gath [12] => Corki [13] => Dr. Mundo [14] => Evelynn [15] => Ezreal [16] => Fiddlesticks [17] => Fiora [18] => Fizz [19] => Galio [20] => Gangplank [21] => Garen [22] => Gragas [23] => Graves [24] => Hecarim [25] => Heimerdinger [26] => Irelia [27] => Janna [28] => Jarvan IV [29] => Jax [30] => Karma [31] => Karthus [32] => Kassadin [33] => Katarina [34] => Kayle [35] => Kennen [36] => Kog'Maw [37] => LeBlanc [38] => Lee Sin [39] => Leona [40] => Lulu [41] => Lux [42] => Malphite [43] => Malzahar [44] => Maokai [45] => Master Yi [46] => Miss Fortune [47] => Mordekaiser [48] => Morgana [49] => Nasus [50] => Nautilus [51] => Nidalee [52] => Nocturne [53] => Nunu [54] => Olaf [55] => Orianna [56] => Pantheon [57] => Poppy [58] => Rammus [59] => Renekton [60] => Riven [61] => Rumble [62] => Ryze [63] => Sejuani [64] => Shaco [65] => Shen [66] => Shyvana [67] => Singed [68] => Sion [69] => Sivir [70] => Skarner [71] => Sona [72] => Soraka [73] => Swain [74] => Talon [75] => Taric [76] => Teemo [77] => Tristana [78] => Trundle [79] => Tryndamere [80] => Twisted Fate [81] => Twitch [82] => Udyr [83] => Urgot [84] => Varus [85] => Vayne [86] => Veigar [87] => Viktor [88] => Vladimir [89] => Volibear [90] => Warwick [91] => Wukong [92] => Xerath [93] => Xin Zhao [94] => Yorick [95] => Ziggs [96] => Zilean [97] => Lee Sin [98] => Orianna [99] => Yorick [100] => Leona [101] => Riven [102] => Lulu [103] => Hecarim [104] => Varus [105] => Malphite [106] => Morgana [107] => Ryze [108] => Annie [109] => Cho'Gath [110] => Taric [111] => Jax [112] => Teemo [113] => Warwick [114] => Poppy [115] => Garen [116] => Anivia [117] => Blitzcrank [118] => Corki [119] => Karthus [120] => Twitch [121] => Irelia [122] => Miss Fortune [123] => Galio [124] => Swain [125] => Kennen [126] => Malzahar )
我需要在以下函数中使用这些值中的每一个:
$input=file_get_contents("http://leagueoflegends.wikia.com/api.php?action=query&titles=$value&prop=revisions&rvprop=content&format=xml");
其中$value
是数组中的一个值(例如Ahri
)。
我怎样才能做到这一点?
编辑:我通过执行以下操作获得这些值:
$file = file_get_contents('http://leagueoflegends.wikia.com/api.php?action=query&titles=List_of_champions&prop=revisions&rvprop=content&format=xml');
preg_match_all('/{{ci\|([^}]*)}}/', $file, $matches);
(上面提到的数组在哪里$matches
。)