php输出cvs文件,下载cvs文件

function outputCsv($data, $filename = 'file.csv') {//输出文件,下载文件
	header('Content-Type:application/force-download');
	header("content-Disposition:filename={$filename}");
	foreach ($data as $fields) {
		foreach ($fields as $key => $value) {
			echo $value . ',';
		}
		echo "\r\n";
	}
}

  php输出cvs文件,下载cvs文件

posted on 2014-08-27 11:14  chenzhaojx  阅读(399)  评论(0编辑  收藏  举报

导航