该脚本可以生成File Excel。但是在您的情况下,您需要格式的数组来提取:
User | talk_time | acw | idle
10227 | 8 | 0 | 6
10236 | 10 | 3 | 0
剧本:
<?php
$file="demo.xls";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
$array = array(
array(10, 15, 20),
array(10, 15, 20),
array(10, 15, 20)
);
?>
<table>
<?php foreach($array as $row): ?>
<tr>
<?php foreach($row as $col):?>
<td><?php echo $col ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>