function outputXlsHeader($data,$file_name = ‘export’)
{
header(‘Content-Type: text/xls’);
header ( “Content-type:application/vnd.ms-excel;charset=utf-8″ );
$str = mb_convert_encoding($file_name, ‘gbk’, ‘utf-8’);
header(‘Content-Disposition: attachment;filename=”‘ .$str . ‘.xls”‘);
header(‘Cache-Control:must-revalidate,post-check=0,pre-check=0’);
header(‘Expires:0’);
header(‘Pragma:public’);
$table_data = ‘
foreach ($data as $line)
{
$table_data .= ‘
’;foreach ($line as $key => &$item)
{
$item = mb_convert_encoding($item, ‘gbk’, ‘utf-8’);
$table_data .= ‘
’ . $item . ‘’;}
$table_data .= ‘
’;}
$table_data .='
’;echo $table_data;
die();
}