Php MS EDGE中文件名为日语的CSV导出问题
我在使用PHP导出CSV时遇到问题,文件名使用日语,使用MS EDGE时会变得凌乱 我写的这段代码:Php MS EDGE中文件名为日语的CSV导出问题,php,csv,header,export,encode,Php,Csv,Header,Export,Encode,我在使用PHP导出CSV时遇到问题,文件名使用日语,使用MS EDGE时会变得凌乱 我写的这段代码: $filename = $this->lang->line('UM000107R001').".csv"; //japan ob_clean(); header('Content-Encoding: UTF-8'); header('Content-Type: text/csv; charset=utf-8' ); header('Content-Disposition: atta
$filename = $this->lang->line('UM000107R001').".csv"; //japan
ob_clean();
header('Content-Encoding: UTF-8');
header('Content-Type: text/csv; charset=utf-8' );
header('Content-Disposition: attachment; filename='.mb_convert_encoding($filename,"UTF-8"));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
$fp = fopen('php://output', 'w');
//This line is important:
fputs( $fp, "\xEF\xBB\xBF" ); // UTF-8 BOM !!!!!
$header = array(
mb_convert_encoding($this->lang->line('EI000107B089'),"UTF-8"),
);
fputcsv($fp, $header);
foreach($data->result() as $key => $value){
$body = array(
mb_convert_encoding($value->ID,"UTF-8"),
);
fputcsv($fp, $body);
}
fclose($fp);
ob_flush();