【发布时间】:2015-07-23 00:27:57
【问题描述】:
我有数组:
Array
(
[CS] => Array
(
[Zomblerz] => 1.80
[Quintic] => 2.06
[Mostly Harmless] => 2.21
[Nexus eSports] => 1.70
[WinOut.net] => 2.73
[Ace Gaming] => 1.48
[Luminosity Gaming] => 3.68
[Natus Vincere] => 1.30
)
[LoL] => Array
(
[Jin Air Green Wings] => 1.17
[Incredible Miracle] => 5.40
[Rebels Anarchy] => 1.27
[SBENU Sonicboom] => 3.92
[SK Telecom T1] => 1.19
[CJ Entus] => 4.95
[KOO Tigers] => 1.38
[NaJin e-mFire] => 3.15
)
[StarCraft] => Array
(
[Maru] => 1.48
[Zest] => 2.73
[Stats] => 1.90
[ByuL] => 1.94
)
)
我想用 {section} 在 Smarty 中显示我的数组,但我有一个字符串索引键并且不能这样做。 我试过 {foreach},但结果太糟糕了。
{section name=i loop=$odds}
<table>
<th> here i want game name... </th>
{section name=j loop=$odds[i]}
<tr>
<td> here team name - here team number </td>
...
</tr>
{/section}
</table>
{/section}
你能帮帮我吗?
附:对不起我的英语(
【问题讨论】:
-
array_values();将删除字符串键
-
@ArtisiticPhoenix
array_values()会导致 OP 出现问题,他们想做<th> here i want game name... </th>,这看起来是字符串键。 -
@Sean 可能是,但这是我读到的
i have a string index keys and cant do this我不使用 smarty,我使用 php :)