如何使用Codeigniter 2.2.6版本通过多维数组在视图中显示表行

时间:2018-02-12 08:42:42

标签: codeigniter-2

如何通过在codeignator 2.2.6 version中插入或传递多维数组来显示视图中的表行。

1

我的模板(我的视图文件:)

<table>
<thead>
     <tr>
         <th>City</th>
         <th>Hotel</th>
     </tr>
 </thead>
 <tbody>
     <?php if((sizeof($result))>0){

        $array =  explode(',',$result->city);

            foreach($array as $info){
            ?>
                <tr>
                   <td><?php echo $info ;?></td>
                   <?php 
                    $arrays =  explode(',',$result->hotel_aboard);
                   foreach($arrays as $infos){?>
                   <td><?php echo $infos ;?></td>
                <?php } ?>
                 </tr>

            <?php
            } 

      }else{ ?>
            <tr><td colspan='3'>Data Not Found</td></tr>
       <?php } ?>
 </tbody>

</table>

输出: 我的输出显示如下所示,但我需要两列而不是第三列geeting输出双倍时间 my output display as below as shown but I need two columns not that third column geeting output double time

1 个答案:

答案 0 :(得分:0)

大家好,我最后找到了解决方案,因为我已经从5天时间努力工作,我只是按照流程进行了一个链接

&#34; https://eval.in/376541&#34;