文件名命名乱码的问题:

$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);