exportDa.php
1.79 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
<?php
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
$title = date('Y-m-d') . '_维修厂';
$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 border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse">
<thead>
<tr>
<th style="width:60px">ID</th>
<th style="width:120px">维修厂名称</th>
<th style="width:100px">维修厂电话</th>
<th style="width:100px">注册时间</th>
</tr>
</thead>
<tbody>
<?php foreach ($listdata as $user) : ?>
<tr>
<td class="text-center align-middle hqy-row-select"><?=$user['id'] ?></td>
<td><?=$user['name']?></td>
<td><?=$user['mobile']?></td>
<td><?=date('Y-m-d H:i', $user['created_at'])?></td>
</tr>
<?php
$cnt++;
if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题
ob_flush();
flush();
$cnt = 0;
}
?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</body>
</html>