【发布时间】:2017-01-25 16:38:19
【问题描述】:
我似乎无法仅将特定信息输出到 csv 或任何文件中。以下内容,例如,从页面输出 html,而不是我试图发送到申请人.csv 的数据:
($a_Lines 数组已被填充):
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="Applicants.csv"');
header('Pragma: no-cache');
header('Expires: 0');
$file = fopen('php://output', 'w');
foreach ( $a_Lines as $row ) {
fputcsv($file, $row);
}
fclose($file);
【问题讨论】: