您好,欢迎访问一九零五行业门户网

php导出excel乱码有关问题

php导出excel乱码问题
最近在做一个php导入导出excel;
试了phpexcel 和spreadsheet_excel_writer都是不好用的,保存本地是好用的,可是输出浏览器就是乱码,而且可以看到乱码的文件应该是当前网页的html。谁能解决一下
// 创建一个处理对象实例  
$objexcel = new phpexcel();
//*************************************  
//设置文档基本属性  
$objprops = $objexcel->getproperties();  
$objprops->setcreator(zeal li);  
$objprops->setlastmodifiedby(zeal li);  
$objprops->settitle(office xls test document);  
$objprops->setsubject(office xls test document, demo);  
$objprops->setdescription(test document, generated by phpexcel.);  
$objprops->setkeywords(office excel phpexcel);  
$objprops->setcategory(test);
//*************************************  
//设置当前的sheet索引,用于后续的内容操作。  
//一般只有在使用多个sheet的时候才需要显示调用。  
//缺省情况下,phpexcel会自动创建第一个sheet被设置sheetindex=0  
$objexcel->setactivesheetindex(0);
$objactsheet = $objexcel->getactivesheet();
//设置当前活动sheet的名称  
$objactsheet->settitle('testsheet');
//到浏览器  
header(content-type: application/vnd.ms-excel; charset=utf-8);
header(content-type: application/force-download);  
header(content-type: application/octet-stream);  
header(content-type: application/download);  
header(content-type:charset=utf-8);
header('content-type: application/vnd.ms-excel');  
header(content-transfer-encoding: binary);  
header('content-disposition: attachment;filename=01simple.xls');
header('cache-control: max-age=0');
$objwriter = phpexcel_iofactory::createwriter($objexcel, 'excel5');
$objwriter->save('01simple.xls');
$objwriter->save('php://output');
保存在服务器上的文件是好的,可是弹出保存在客户端的文件有问题。
乱码如:
邢唷?;?
? b?=?r8x1?calibri? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 8?纮?櫃?f?f烫?櫶?櫶虣?虣3f?烫櫶ff枛3f3檉333f33333 testsheetg
$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ }$ } $ }!!$ }$ }##$ }$$$ }%%$ }&&$ }''$ }(($ }))$ }**$ }++$ },,$ }--$ }..$ }//$ }00$ }11$ }22$ }33$ }44$ }55$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