Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
过去两天我一直在寻找解决方案,但我似乎找不到。基本上我想把我的菜单分开,一侧有1-4类,另一侧有5-8类。例如,我似乎无法计算出显示 1-4 个类别的代码。
我正在使用 v1.5.4.1
有任何想法吗?
为此,如果您使用一定数量的类别,您可以只使用几个简单的循环
<?php for($i = 0; $i < 4; $i++) { if(empty($categories[$i])) continue; $cat = $categories[$i]; // Work with $cat here for each category item } ?>
这将遍历类别数组中的前四个类别。对于第二个循环,= 0用= 4和< 4替换做同样的事情< 9
= 0
= 4
< 4
< 9