//输出到临时缓冲区 提供下载
header("Content-type:application/vnd.ms-excel;charset=UTF-8");
$ua = $_SERVER["HTTP_USER_AGENT"];
$encoded_filename = urlencode($this->fileName);
$encoded_filename = str_replace("+", "%20", $encoded_filename);
header('Content-Type: application/octet-stream');
if (preg_match("/Triden/",$ua)) { //IE
header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
} else if (preg_match("/Firefox/", $ua)) {
header('Content-Disposition: attachment; filename*="utf8\'\'' . $this->fileName . '"');
} else {
header('Content-Disposition: attachment; filename="' . $this->fileName . '"');
}
header('Cache-Control: max-age=0');
$objWriter = \PHPExcel_IOFactory::createWriter ( $this->excelObj, 'Excel5' );
$objWriter->save ( 'php://output' );