我正在尝试将一个数组(数组?)转换为一个简单的无序列表。我想出了一个解决方案,但它非常庞大,我很肯定有一种更简单的方法可以做到这一点。
这是数组
Array (
[0] => Array ( [projects_id] => 204 [City] => Carrollton )
[1] => Array ( [projects_id] => 2 [City] => Dallas )
[2] => Array ( [projects_id] => 208 [City] => Garland )
[3] => Array ( [projects_id] => 1 [City] => Plano )
[4] => Array ( [projects_id] => 212 [City] => Richardson )
)
列表应该是这样的
<ul>
<li><a href="#">Carrollton</a>
<li><a href="#">Dallas</a>
<li><a href="#">Garland</a>
<li><a href="#">Plano</a>
<li><a href="#">Richardson</a>
</ul>