我必须遍历一个数组来填充UL-LI结构。
我的数组是这样的:
$mynewarray=array(
0=>_("Pro"),
1=>_("Stunt"),
2=>_("Donated"),
3=>_("Lead"),
);
我的ul-li结构是这样的:
<ul class="dropdown-menu" aria-labelledby="dropdownMenu">
<li class="dropdown-header" style="cursor:pointer;"><?=_('aaaaa')?></li>
<li><a class="xxx" style="cursor:pointer;" value="myvalue"><?=_('Promo')?></a></li>
<li><a class="xxx" style="cursor:pointer;" value="myvalue"><?=_('Stunt')?></a></li>
<li><a class="xxx" style="cursor:pointer;" value="myvalue"><?=_('Donated')?></a></li>
</ul>
如何使用foreach
功能填充我的li
列表以获得这样的结构?
<li><a class="xxx" style="cursor:pointer;" value="myvalue" type="ARRAY POSITION"> ARRAY FIELD</a></li>
对于Ex:
<li><a class="xxx" style="cursor:pointer;" value="myvalue" type="0"> PRO</a></li>
非常感谢
答案 0 :(得分:0)
+--------------+--------+
| name | age | count |
+--------+-----+--------+
| Joe | 10 | 2 |
+--------+-----+--------+
| Bob | 11 | 1 |
+--------+-----+--------+
| Lisa | 12 | 1 |
+--------+-----+--------+