パブリック静的関数 saveExcel($objPHPExcel, $excelName, $output) {
$objWriter = PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' );
if (! strpos ( $_SERVER ['HTTP_USER_AGENT'], 'Firefox' ))
$excelName = urlencode ( $excelName );
if ($output) {
ob_end_clean ();
header ( "Content-Type: application/force-download" );
header ( "Content-Type: application/octet-stream" );
header ( "Content-Type: application/download" );
header ( "Content-Disposition:attachment; filename=" . $excelName . ".xls" );
header ( "Content-Transfer-Encoding: バイナリ" );
header ( "有効期限: 1997 年 7 月 26 日月曜日 05:00:00 GMT" );
header ( "Last-Modified: " . gmdate ( "D, d M Y H:i:s" ) . " GMT" );
header ( "キャッシュ制御: 必須再検証、事後チェック = 0、事前チェック = 0" );
header ( "プラグマ: キャッシュなし" );
$objWriter->save ( 'php://output' );
} その他 {
$objWriter->save ( "Excel/" . $excelName . ".xls" );
echo '';
}
}
lpdx111の抜粋