文件名命名乱码的问题:

$ua = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/MSIE/',$ua)) {
  $file_name = str_replace('+','%20',urlencode($file_name));
}

 

文件内容有中文字符的:

 

header('Content-Type:application/csv;charset=UTF-8');//application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
header('Content-Disposition: attachment;filename="' . $file_name . '"');
header('Cache-Control: No-cache');
    
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
    
//set CSV file to UTF-8
$objWriter->setUseBOM(true);

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2021-04-24
  • 2021-06-16
猜你喜欢
  • 2022-01-14
  • 2021-09-16
  • 2021-12-31
相关资源
相似解决方案