首页 > 代码库 > foreach遍历 < 创建表 >练习题
foreach遍历 < 创建表 >练习题
1 </head> 2 3 <body> 4 <table border="1" width="500" height="300"/> 5 <tr> 6 <th>Ids</th> 7 <th>Name</th> 8 <th>Price</th> 9 <th>Source</th> 10 <th>Numbers</th> 11 <th>Image</th> 12 </tr> 13 <?php 14 $arr=array( 15 array("k001","苹果","2.4","烟台","100","image/0.gif"), 16 array("k002","菠萝","2.4","广东","100","image/1.gif"), 17 array("k003","橘子","2.4","福州","100","image/2.gif"), 18 array("k004","葡萄","2.4","新疆","100","image/3.gif"), 19 ); 20 foreach($arr as $v) 21 { 22 echo"<tr> 23 <td>{$v[0]}</td> 24 <td>{$v[1]}</td> 25 <td>{$v[2]}</td> 26 <td>{$v[3]}</td> 27 <td>{$v[4]}</td> 28 <td>{$v[5]}</td> 29 </tr>"; 30 } 31 ?> 32 33 </table> 34 </body> 35 </html>
原图:
效果图:
foreach遍历 < 创建表 >练习题
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。