/**
- @param string $fileName 文件名
- @param array $headArr 表格头部
- @param array
d
a
t
a
数
组
形
式
∗
/
f
u
n
c
t
i
o
n
e
x
p
o
r
t
T
o
E
x
c
e
l
(
data 数组形式 */ function exportToExcel(
data数组形式∗/functionexportToExcel(fileName = ‘’, $headArr = [], KaTeX parse error: Expected '}', got 'EOF' at end of input: …ion:filename=".fileName.’.csv’);
f p = f o p e n ( ′ p h p : / / o u t p u t ′ , ′ w ′ ) ; f w r i t e ( fp=fopen('php://output','w'); fwrite( fp=fopen(′php://output′,′w′);fwrite(fp, chr(0xEF).chr(0xBB).chr(0xBF));
fputcsv( f p , fp, fp,headArr);
i n d e x = 0 ; f o r e a c h ( index = 0; foreach ( index=0;foreach(data as KaTeX parse error: Expected '}', got 'EOF' at end of input: …tem) { if(index==1000){ //每次写入1000条数据清除内存
$index=0;
ob_flush();//清除内存
flush();
}
i n d e x + + ; f p u t c s v ( index++; fputcsv( index++;fputcsv(fp,$item);
}
ob_flush();
flush();
ob_end_clean();
exit();
}