请我有以下数组:
array(3) {
[0]=>
array(2) {
[0]=>
string(6) "lkjhgj"
[1]=>
string(16) "jhgjhg@jhgjj.com"
}
[1]=>
array(2) {
[0]=>
string(5) "hgjk,"
[1]=>
string(18) "kjhgfghj@dgdfg.com"
}
[2]=>
array(2) {
[0]=>
string(9) "dddd ffff"
[1]=>
string(13) "dddd@gmail.fr"
}
}
我想把它放到一个 csv 文件中,所以我试过:
$fichier = 'file.csv';
$fp = fopen($fichier, 'w');
foreach ($list as $fields)
{
fputcsv($fp, $fields);
}
fclose($fp);
header( 'Content-Type: text/csv' );
header( 'Content-Disposition: attachment;filename='.$fichier);
但是当我下载文件时,我发现它是空的!
请高手有什么想法?提前致谢
PS:权限是777