脚本宝典收集整理的这篇文章主要介绍了PHPExcel在AWS上运行代码时写入垃圾字符.,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
error_reporting(E_ALL); ini_set('display_errors',TRUE); ini_set('display_startup_errors',TRUE); date_default_timezone_set('EuroPE/London'); if (PHP_SAPI == 'cli') die('This example should only be run From a Web browser'); /** Include PHPExcel */ require_once '../Classes/PHPExcel.PHP'; // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document PRoperties $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTITle("Office 2007 XLSX test Document") ->setSubject("Office 2007 XLSX Test Document") ->setDescription("Test document for Office 2007 XLSX,generated using PHP classes.") ->setKeywords("office 2007 openXMl PHP") ->setCategory("Test result file"); // Add some data $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A1','Hello') ->setCellValue('B2','world!') ->setCellValue('C1','Hello') ->setCellValue('D2','world!'); // Miscellaneous glyphs,UTF-8 $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A4','Miscellaneous glyphs') ->setCellValue('A5','éàèùâêîôûëïüÿäöüç'); // rename worksheet $objPHPExcel->getActiveSheet()->setTitle('Simple'); // Set active sheet index to the First sheet,so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); // redirect output to a client’s web browser (Excel5) header('Content-type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="01simple.xls"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9,then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL,then the following may be needed header ('Expires: Mon,26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D,d M Y H:i:s').' GMT'); // always modified header ('Cache-Control: cache,must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,'Excel5'); $objWriter->save('PHP://output');
PKU~AG�D�X�[Content_Types].xML��MN�0��"�%nY ��vAa �(0��ؖg�w{&i�@�nbE�{��y��d۸l m�����X�(���)���F��;@1_�����c)j�x/%��E��y� �QĿi!��K�
以上是脚本宝典为你收集整理的PHPExcel在AWS上运行代码时写入垃圾字符.全部内容,希望文章能够帮你解决PHPExcel在AWS上运行代码时写入垃圾字符.所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。