我有一个显示组织树的页面,但是在第 2 级有重复的项目。我想要的是避免重复...
这是示例显示:
<ul id="org" style="display: none;">
<li>Brit School
<ul>
<li>Amy Winehouse
<ul>
<li>Carina Round</li>
</ul>
</li>
<li>Adele Adkins
<ul>
<li>Kreayshawn K</li>
<li>Leona Lewis</li>
</ul>
</li>
<li>Adele Adkins
<ul>
<li>Kreayshawn K</li>
<li>Leona Lewis</li>
</ul>
<li>Arctic Monkey
<ul>
<li>PJ Harvey</li>
</ul>
</li>
</ul>
</li>
我想省略第二条记录 Adele 这是我在 PHP 中的示例代码
<ul id="org" style="display: none;">
<?php foreach ($lvl1 as $genesA) {?>
<li>
<?php echo $genesA->LevelFullName1?>
<?php if($genesA->lvlMemF) {?>
<ul>
<?php if($genesA->lvlMemF) {?>
<?php foreach ($lvl2 as $genesB) {?>
<?php if($genesB->lvlMemS) {?>
<li><?php echo $genesB->LevelFullName2 ?>
<?php if($genesB->lvlMemS) {?>
<ul>
<?php if($genesB->lvlMemS) {?>
<?php foreach ($lvl3 as $genesC) {?>
<?php if($genesB->lvlMemS == $genesC->referrerLvl3) {?>
<li>
<?php echo $genesC->LevelFullName3?>
</li>
<?php } ?>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } else { ?>
<?php } ?>
<?php } ?>
<?php } ?>
</ul>
<?php }?>
</li>
<?php } ?>
我不太确定我是否走在正确的轨道上我只想要一个肮脏的修复就是这样:)