把路径改成你要的就行了.phpexcel资源我放在贵哥的编程之路资源里面哈.
1.php
<?php
require "F:/6/htdocs/PHPExcel-1.8/Classes/PHPExcel.php";//引入PHPExcel对象
$objPHPExcel=new PHPExcel();//创建对象
$objSheet=$objPHPExcel->getActiveSheet();//拿到对象的操作方法来做事
$objSheet->setTitle("demo");//excel标题
$objSheet->setCellValue("A1","姓名")->setCellValue("B1","分数");
//A1 写姓名 B2写分数,看下面的图片哈
$objSheet->setCellValue("A2","张三")->setCellValue("B2","50");
/*$array=array(
array("姓名","分数"),
array("李四","60"),
array("王五","70")
);*/
//或者生成数组也行
$objWriter=PHPExcel_IOFactory::createWriter($objPHPExcel,"Excel2007");
//生成excel2007版本号
$objWriter->save("F:/6/htdocs/PHPExcel-1.8/Classes/demo.slsx");
//保存也就是创建出来!
?>