이 스크립트를 생성할 수 있는 파일 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>