Blogger Information
Blog 25
fans 0
comment 0
visits 18931
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
221作业
℃级的博客
Original
767 people have browsed it

循环遍历二维数组 

<?php
$stus=[
['name'=>'张三','sex'=>'男','age'=>29,'workage'=>10],
['name'=>'李四','sex'=>'女','age'=>25,'workage'=>3],
['name'=>'小李','sex'=>'男','age'=>27,'workage'=>5]
];

$title="工人档案";
$total=count($stus);

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
	<title></title>
</head>
<body>
    <table style="border:1px solid #ccc">
      <caption style="border:1px solid #ccc">工人档案</caption>
          <thead >
            <tr >
               <th>name</th>
               <th>sex</th>
               <th>age</th>
               <th>workage</th>
            </tr>
          </thead>
              <tbody>
 <?php 
 $data='';
  foreach ($stus as $key) {
       $data.='<tr>'; 
       $data.='<td>'.$key['name'].'</td>';
       $data.='<td>'.$key['sex'].'</td>';
       $data.='<td>'.$key['age'].'</td>';
       $data.='<td>'.$key['workage'].'</td>';
       $data.='</tr>';
               }

 echo $data;  //将生成的html代码发到浏览器进行显示             

  ?>                  
              </tbody>
    </table>
    <p>总计:<?=$total;?>个员工</p>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

学生管理系统后台-a链接和iframe框架进行链接


实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
	<title></title>
	<style type="text/css">
     .header{border:1px solid #ccc;width:1102px;background: rgba(120,160,50,0.8);margin:0 auto;}
     .header .header-n  {margin-left: 100px;width:300px;}
     .context{position:relative;margin:0 auto;width:1102px;}
     .left{float:left;width:200px;height:800px;border:1px solid #ccc;background: rgba(100,60,90,0.8);}
     .left ul li a{color:pink;text-align:center;text-decoration:none}
     .left ul li{list-style-type:none;margin-top:10px;}
     .left ul {margin-left: 20px}
     .right{float:left;width:898px;height:800px;border:1px solid #ccc;}
     .right iframe{width:850px;height:800px;margin-left:20px;padding:3,10;}
	</style>
</head>
<body>
<div class="header" >
<div class="header-n"><p><h1>员工管理系统</h1></p></div>
</div>
<div class="context">
<div class="left">
<ul>
<li><a href="http://www.baidu.com/" target="stu">百度</a></li>
<li><a href="http://www.sohu.com/" target="stu">搜狐</a></li>
<li><a href="http://www.taobao.com/" target="stu">淘宝</a></li>
</ul>
</div>
<div class="right"> 
<iframe src="http://www.163.com/" name="stu"></iframe>
</div>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post