怎么循环带条件的数组

WBOY
Release: 2016-06-13 12:08:06
Original
996 people have browsed it

如何循环带条件的数组

本帖最后由 albb_num1 于 2014-10-18 20:47:12 编辑 下面这个数组

<br />$abc=array(     <br />[navigation_list] => Array<br />        (<br />            [0] => Array<br />                (<br />                    [navigation_id] => 1<br />                    [navigation_title] => 题目1<br />                    [navigation_link] => http://127.0.0.1/<br />                    [navigation_sort] => 255<br />                    [navigation_open_type] => 1<br />                )<br /><br />            [1] => Array<br />                (<br />                    [navigation_id] => 2<br />                    [navigation_title] => 题目2<br />                    [navigation_link] => http://127.0.0.1/circle<br />                    [navigation_sort] => 255<br />                    [navigation_open_type] => 1<br />                )<br /><br />            [2] => Array<br />                (<br />                    [navigation_id] => 3<br />                    [navigation_title] => 题目3<br />                    [navigation_link] => http://127.0.0.1/microshop<br />                    [navigation_sort] => 255<br />                    [navigation_open_type] => 1<br />                )<br /><br />            [3] => Array<br />                (<br />                    [navigation_id] => 4<br />                    [navigation_title] => 题目4<br />                    [navigation_link] => http://127.0.0.1/shop/index.php?act=brand<br />                    [navigation_sort] => 255<br />                    [navigation_open_type] => 1<br />                )<br /><br />        )<br />)<br />
Copy after login

如果我想循环出后面二个数组,即前面两个不要,怎么写条件呢
下面代码是我写的,为啥循环不出来呢,哪里错了:
<br /><?php <br />      <br />      if ($abct[navigation_list][navigation_id]>2 || $output[navigation_list][navigation_id]>5){<br />      foreach($output['navigation_list'] as $value) {?><br />      <li class="link"><a href="<?php echo $value['navigation_link'];?>" <?php echo $value['navigation_open_type']=='1'?'target="_blank"':'';?>><?php echo $value['navigation_title'] ?></a></li><br />      <?php } ?><br />      <?php }?><br />
Copy after login

------解决思路----------------------
<?php <br />      foreach($abc['navigation_list'] as $value) {?><br><?php  if ($value['navigation_id']>2){ ?>     <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template