<?php require "./PHPExcel.php"; $dir=dirname(__FILE__); $objPHPExcel=new PHPExcel(); $objSheet=$objPHPExcel->getActiveSheet();//获得当前活动的sheet $objSheet->setTitle("demo"); $array=array( array("姓名","分数"), array("李四","60"), array("张三","90"), ); $objSheet->fromArray($array); $objwriter=PHPExcel_IOFactory::createWriter($objPHPExcel,"Excel2007"); $objwriter->save($dir."/demo.xlsx");