1. 程式人生 > >php生成Exeple表demo

php生成Exeple表demo

ofa dirname blog factory eat factor name pre array

<?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");

  

php生成Exeple表demo