首页 > 代码库 > foreach遍历打印表格
foreach遍历打印表格
<?php $ios = [ ‘oyf‘ => [‘欧阳锋‘,‘1000‘,‘34‘], ‘yg‘ => [‘杨过‘,‘1001‘,‘24‘], ‘hr‘ => [‘黄蓉‘,‘1002‘,‘14‘] ]; $php = [ ‘oyf‘ => [‘欧阳锋‘,‘1000‘,‘34‘], ‘yg‘ => [‘杨过‘,‘1001‘,‘24‘], ‘hr‘ => [‘黄蓉‘,‘1002‘,‘14‘] ]; $javaee = [ ‘oyf‘ => [‘欧阳锋‘,‘1000‘,‘34‘], ‘yg‘ => [‘杨过‘,‘1001‘,‘24‘], ‘hr‘ => [‘黄蓉‘,‘1002‘,‘14‘] ]; $andriod = [ ‘oyf‘ => [‘欧阳锋‘,‘1000‘,‘34‘], ‘yg‘ => [‘杨过‘,‘1001‘,‘24‘], ‘hr‘ => [‘黄蓉‘,‘1002‘,‘14‘] ]; $h5 = [ ‘oyf‘ => [‘欧阳锋‘,‘1000‘,‘34‘], ‘yg‘ => [‘杨过‘,‘1001‘,‘24‘], ‘hr‘ => [‘黄蓉‘,‘1002‘,‘14‘] ]; $ui = [ ‘oyf‘ => [‘欧阳锋‘,‘1000‘,‘34‘], ‘yg‘ => [‘杨过‘,‘1001‘,‘24‘], ‘hr‘ => [‘黄蓉‘,‘1002‘,‘14‘] ]; $qianfen =[ ‘PHP‘ =>$php, ‘iOS‘ => $ios, ‘Andriod‘ => $andriod, ‘HTML5‘ => $h5, ‘UI‘ =>$ui, ‘JavaEE‘ =>$javaee ]; echo ‘<br />‘; echo ‘<h1 align="center">古代英雄美人</h1>‘; //foreach实现 foreach ($qianfen as $key=>$value) { echo ‘<table width="888" align="center" border="1">‘; echo ‘<caption><h2>‘.$key.‘</h2></caption>‘; echo ‘<tr align="center"><th>姓名</th><th>工号</th><th>年龄</th></tr>‘; foreach ($value as $v) { echo ‘<tr align="center" >‘; foreach ($v as $info) { echo ‘<td align="center">‘.$info.‘</td>‘; } echo ‘</tr>‘; } echo ‘</table>‘; } ?>
本文出自 “你好我是森林” 博客,请务必保留此出处http://chensenlin.blog.51cto.com/10559465/1854680
foreach遍历打印表格
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。