batch-export.php
2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
$title = iconv('UTF-8','GBK','序列号按批次统计');
$name = $title . ".xls";
header('Content-Disposition: attachment;filename=' . $name . '');
header('Cache-Control: max-age=0');
$fp = fopen('php://output', 'a');
$limit = 10000;
$cnt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>
<div id="Classeur1_16681" align='center' x:publishsource="Excel">
<table x:str border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse">
<thead>
<tr>
<th width="10%">批次编码</th>
<th width="15%">序列号</th>
<th width="12%">MAC地址</th>
<th width="10%">设备ID</th>
<th width="10%">申请时间</th>
<th width="10%">授权时间</th>
<th width="10%">状态</th>
</tr>
</thead>
<tbody>
<?php foreach ($deviceList as $key => $item) : ?>
<tr>
<td class="td-cls">
<?= $item['batch_no'] ?>
</td>
<td class="td-cls">
<div class="cell-cls"><?= $item['serial_no'] ?></div>
</td>
<td class="td-cls">
<?= $item['mac'] ?>
</td>
<td class="td-cls">
<?= $item['device_id']? $item['device_id']:'暂无'?>
</td>
<td class="td-cls">
<?= $item['apply_at']?date('Y-m-d H:i:s', $item['apply_at']):'暂无' ?>
</td>
<td class="td-cls">
<?= $item['auth_at']? date('Y-m-d H:i:s', $item['auth_at']):'暂无' ?>
</td>
<td class="td-cls">
<?= $statusList[$item['status']] ?>
</td>
</tr>
<?php
$cnt++;
if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题
ob_flush();
flush();
$cnt = 0;
}
?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</body>
</html>