<?php   if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Do_output extends CI_Controller {
   function __construct(){
     parent::__construct();
     header('Content-Type:text/html; charset=utf-8,gb2312'); 
            $this->load->library("phpexcel");
            $this->load->library("PHPExcel/iofactory");
                
    }
    function index(){ 
    }
  
    function outputExcel(){
       $objPHPExcel = new PHPExcel();//创建一个excel
       $objWriter = IOFactory::createWriter($objPHPExcel, "Excel5");   //2007以下的版本          //到浏览器 
          $outputFileName = date('Y_m_d').'.xls';
          $outputFileName = mb_convert_encoding($outputFileName, "gb2312", "UTF-8");          header("Content-Type: application/force-download");
          header("Content-Type: application/octet-stream");
          header("Content-Type: application/download");
          header("Content-type:application/vnd.ms-excel");
          header('Content-Disposition:inline;filename="'.$outputFileName.'"');
          header("Content-Transfer-Encoding: binary");
          header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
          header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
          header("Pragma: no-cache");
          $objWriter->save("php://output"); 
          exit;
         }
}
       我是用ci框架写的,
这样不是会输出一个空的excel表格吗?为什么  打开是乱码呢?