<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="jquery/jquery-3.3.1.min.js"></script>
<script src="layui/layui.js"></script>
<link rel="stylesheet" href="layui/css/layui.css">
<style type="text/css">
</style>
</head>
<body>
<?php
$strffs=[
['id'=>1,'name'=>'侯亮平','age'=>30,'sex'=>1,'email'=>'hlp@qq.com','password'=>sha1(123456)],
['id'=>2,'name'=>'李达康','age'=>50,'sex'=>1,'email'=>'ldk@qq.com','password'=>sha1(123456)],
['id'=>3,'name'=>'祁同伟','age'=>45,'sex'=>1,'email'=>'qtw@qq.com','password'=>sha1(123456)],
['id'=>4,'name'=>'高小琴','age'=>28,'sex'=>0,'email'=>'gxq@qq.com','password'=>sha1(123456)],
['id'=>5,'name'=>'赵瑞龙','age'=>40,'sex'=>1,'email'=>'zrl@qq.com','password'=>sha1(123456)],
];
$data='';
foreach ($strffs as $strff) {
$data.='<tr>';
$data.='<th>'.$strff['id'].'</th>';
$data.='<th>'.$strff['name'].'</th>';
$data.='<th>'.$strff['age'].'</th>';
$data.='<th>'.$strff['sex'].'</th>';
$data.='<th>'.$strff['email'].'</th>';
$data.='<th>'.$strff['password'].'</th>';
$data.='</tr>';
}
?>
<table>
<colgroup>
<col width="150">
<col width="200">
<col>
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>邮箱</th>
<th>密码</th>
</tr>
</thead>
<tbody>
<?=$data?>
<?php foreach ($strffs as $strff) :?>
<tr>
<th><?=$strff['id'] ?></th>
<th><?=$strff['name'] ?></th>
<th><?=$strff['age'] ?></th>
<th>
<?php if($strff['sex']===1): ?>
男
<?php else: ?>
女
<?php endif; ?>
</th>
<th><?=$strff['email'] ?></th>
<th><?=$strff['sex']? "为了测试占用一下<span style='color:green;'>男</span>":"为了测试占用一下<span style='color:red;'>女</span>" ?></th>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p>玩个参数求和的游戏</p>
<?php
function demo03(){
$sum=0;
for ($i=0; $i <func_num_args() ; $i++) {
$sum=$sum+func_get_arg($i);
}
return $sum;
}
echo demo03(1,2,3,4,5);
?>
<p>每个***都要学会求偶</p>
<?php
$arr=range(0,9);
$arr1=array_map(function($arr2){
if($arr2%2==0){
return $arr2;
}
else{
return '不是偶';
}
}, $arr);
echo '<pre>';
print_r($arr1);
?>
</body>
</html>