标签:header public filename utf-8 UNC isp function ble export
public function excel(){
$filename = ‘导出表格‘;
$header = [‘编号‘,‘名称‘];
$index = [‘id‘,‘name‘];
$list = array(
0 => array(‘id‘ => 1, ‘name‘ => ‘fdfs‘),
1 => array(‘id‘ => 2, ‘name‘ => ‘ffdfdsafs‘),
2 => array(‘id‘ => 3, ‘name‘ => ‘fdfgdgsddfafass‘),
);
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=".$filename.".xls");
$table_header = rtrim(implode("\t",$header), "\t");
$strexport = $table_header."\r";
foreach ($list as $row){
foreach($index as $val){
$strexport .= $row[$val] . "\t";
}
rtrim($strexport,"\t");
$strexport .= "\r";
}
$strexport=iconv(‘UTF-8‘,"GB2312//IGNORE", $strexport);
exit($strexport);
}
标签:header public filename utf-8 UNC isp function ble export
原文地址:https://www.cnblogs.com/qixidi/p/10202476.html