class Excel
{
/**
* 生成excel表格
* @param array $title 表格的 th
* @param array $data 表格数据 td
*/
public static function getExcel($title=array(), $data=array())
{
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=" . date('Y年m月d日') . ".xls");
header('Pragma: no-cache');
header('Expires: 0');
// echo iconv('utf-8', 'gbk', implode("\t", $title)), "\n"; 转码需要权限 chmod -R 777
echo implode("\t", $title), "\n";
foreach ($data as $value) {
echo implode("\t", $value), "\n";
}
}
}