php 導出excel

http://blog.csdn.net/zhaoxuejie/article/details/7243129app

google 的xml excelpost

function export_excel($filename,$title,$data){ ob_end_clean(); ini_set('zlib.output_compression','Off');google

header('Pragma: public'); 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");                   
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); 
header('Cache-Control: no-store, no-cache, must-revalidate');    
header('Cache-Control: pre-check=0, post-check=0, max-age=0');    
header ("Pragma: no-cache"); 
header("Expires: 0"); 
header('Content-Transfer-Encoding: none'); 
header('Content-Type: application/vnd.ms-excel;charset=utf-8');                 
header("Content-type: application/x-msexcel;charset=utf-8"); 
header("Content-disposition: attachment; filename="  . iconv('utf-8', "gb2312", $filename) . ".xls");
$s = '';
if (is_array($title)){
	foreach ($title as $key => $value){
		$s .=  $value."\t";
	}
}
$s .=  "\n";
if (is_array($data)){
	foreach ($data as $key => $value){
		foreach ($value as $_key => $_value){
			$s .=  $_value."\t";
		}
		$s .=  "\n";
	}
}

$s = mb_convert_encoding($s, 'gb2312');
//$s = iconv('utf-8', "gb2312", $s);
exit($s);

}.net

相關文章
相關標籤/搜索