<?php
ini_set('memory_limit',-1); //没有内存限制
require_once dirname(__FILE__) . '/PHPExcel-1.8/Classes/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$row = 1;
foreach ($excel_data as $data) {
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A' . $row, $cat_id)
->setCellValue('B' . $row, $content_id)
->setCellValue('C' . $row, '')
->setCellValue('D' . $row, '')
->setCellValue('E' . $row, '');
$row++;
}
$objPHPExcel->setActiveSheetIndex(0);
// Save Excel 2007 file
echo date('H:i:s'), " Write to Excel2007 format", EOL;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', time() . '.xlsx', __FILE__));
网友评论