php显示中 表格中有两例相同内容的输出方式

来源:互联网 发布:js怎么给div加class 编辑:程序博客网 时间:2024/05/16 05:52
<table cellspacing="0" cellpadding="0">    <thead>        <tr><th class="t1">教程名称</th>            <th class="t2">难度</th>            <th class="t6">时间</th>            <th class="t1">教程名称</th>            <th class="t2">难度</th>            <th class="t6">时间</th>        </tr></thead>                          <tbody><tr>                <td class="t1"><a href="#">一周新闻小测验0:0</a></td>            <td class="t2">入门级</td>            <td class="t3">7月12号到7月13号</td>                 <td class="t1"><a href="#">一周新闻小测验1:1</a></td>            <td class="t2">入门级</td>            <td class="t3">7月2号到7月3号</td>                     </tr>                   <tr>                <td class="t1" style="background: none repeat scroll 0% 0% rgb(244, 244, 244);"><a href="#">一周新闻小测验2:0</a></td>            <td class="t2" style="background: none repeat scroll 0% 0% rgb(244, 244, 244);">入门级</td>            <td class="t3" style="background: none repeat scroll 0% 0% rgb(244, 244, 244);">8月20日--8月23日</td>                 <td class="t1" style="background: none repeat scroll 0% 0% rgb(244, 244, 244);"><a href="#">一周新闻小测验3:1</a></td>            <td class="t2" style="background: none repeat scroll 0% 0% rgb(244, 244, 244);">入门级</td>            <td class="t3" style="background: none repeat scroll 0% 0% rgb(244, 244, 244);">8月20日--8月23日</td>                     </tr>                     </tbody></table>

<php>
        foreach($list as $key=>$item){
            if($key % 2 ==0){
        </php>
          <tr>
        <php>
            }
        </php>
            <td class="t1"><a href="#"><php>echo $item['wj_title'];echo $key.':'.$key%2;</php></a></td>
            <td class="t2"><php>echo $item['wj_nd']</php></td>
            <td class="t3"><php>echo $item['wj_time_rank']</php></td>
         <php>
          if($key % 2 ==1){
         </php>
            </tr>
         <php>
            }
          }  

         </php>



原创粉丝点击