Blogger Information
Blog 27
fans 0
comment 0
visits 22434
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
用for循环做表格填充
不乖的博客
Original
1500 people have browsed it
<?php
	$title='员工信息表';
	$arr = array(
		array(
			'id' => 1,
			'name' => '朱一龙',
			'age' => 18,
			'password'=>'123456'
		),
		array(
			'id' => 2,
			'name' => '阿护',
			'age' => 19,
			'password'=>'123456'
		),
		array(
			'id' => 3,
			'name' => '太师',
			'age' =>20,
			'password'=>'123456'
		),
		array(
			'id' => 4,
			'name' => '徐正曦',
			'age' => 18,
			'password'=>'123456'
		)

	);
?>
<!DOCTYPE html>
<html>
<head>
	<title>员工信息表</title>
	<style>
			*{
				margin: 0;
				padding: 0;
			}
			table{
				widows: 400px;
				margin:100px auto;
				border-collapse:collapse
			}
			th{
				width: 100px;
				height: 30px;
				background: paleturquoise;
				border: 1px solid black
			}
			td{
				width: 100px;
				height: 30px;
				border: 1px solid black;
				text-align: center;
			}
	</style>
</head>
<body>
		<h1><?php
			echo $title;
		?></h1>
		<table cellpadding="0" cellspacing="0">
			<tr>
				<th>编号</th>
				<th>姓名</th>
				<th>年龄</th>
				<th>密码</th>
			</tr>
			<?php
			$length=count($arr);
			$i=0;
			for($i; $i<$length; $i++){
			echo '
			<tr>
				<td>'.$arr[$i]['id'].'</td>
				<td>'.$arr[$i]['name'].'</td>
				<td>'.$arr[$i]['age'].'</td>
				<td>'.$arr[$i]['password'].'</td>
			</tr>
			';
			}?>
		</table>
</body>
</html>


Correction status:Uncorrected

Teacher's comments:
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