php输出csv后 如何将数据输出到网页的问题

2024-12-20 10:07:08
推荐回答(1个)
回答1:

function export_csv($filename, $data) {
header("Content-type:text/csv");
header("Content-Disposition:attachment;filename=" . $filename);
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Expires:0');
header('Pragma:public');
echo $data;
header('content-Type:text/html');
echo "成功!";
}