我在PHP中有一个多维数组,如下所示:
Array
(
[0] => Array
(
[category_id] => 1
[name] => Football Team Name 1
)
[1] => Array
(
[category_id] => 2
[name] => Football Team Name 2
)
[2] => Array
(
[category_id] => 3
[name] => Hockey Team Name 1
)
[3] => Array
(
[category_id] => 4
[name] => Hockey Team Name 2
)
[4] => Array
(
[category_id] => 5
[name] => Hockey Team Name 3
)
第一个单词(称为name的数组键)我总是用作类别标题,因此,我想但到目前为止无法弄清楚如何使最终输出看起来像这样:
就我而言,该解决方案最终应与Smarty一起使用。
如果有任何想法,我将不胜感激。