這篇文章的內容是PHP實作CSV寫入下載的程式碼,現在分享給大家,有需要的朋友也可以參考一下這篇文章的內容
$title1 = '年月\明細,月貸款額,月利潤額,月理論回款額,月實際回款額,月未還款額,月客戶總量'."\n";
header("Cache- Control: public");
header("Pragma: public");
header("Content-type:application/vnd.ms-excel");
$filename = $title;
header("Content-Disposition:attachment;filename=$filename.csv");
header('Content-Type:APPLICATION/OCTET-STREAM');
ob_start();
//$header_str = mb_convert_encoding ($title1,"gbk","utf-8");
//windwos編碼轉換
# 去掉了,換成支援更多字的gbk
",$data);
$header_str = iconv("utf-8","g#k1 ##$csv_line_data = iconv("utf-8","gbk//IGNORE",$csv_line_data);
//$header_str = iconv("utf-8", 'gbk', $title);
//$csv_line_data = iconv("utf-8", 'gbk//IGNORE', $csv_line_data);
# ob_end_clean();
//寫出
# data;
相關推薦:
幾行php程式碼實作CSV格式檔案輸出案例實例詳解PHP從資料庫匯出到.csv檔
以上是Php實作csv寫入下載的詳細內容。更多資訊請關注PHP中文網其他相關文章!