Ниже представлен код, скачивает в папку сервера, а хочется чтоб в буфер браузера:
<?php
include 'catalog.php';
$link = mysqli_connect('localhost', 'root', '', 'eshop');
$query1 = mysqli_query($link, "SELECT * FROM goods ORDER BY id");
require_once './PHPExcel/Classes/PHPExcel.php';
$phpexcel = new PHPExcel();
$page = $phpexcel->setActiveSheetIndex(0);
$page->setCellValue("A1", "id");
$page->setCellValue("B1", "name");
$page->setCellValue("C1", "cost");
$page->setCellValue("D1", "description");
$page->setCellValue("E1", "ord");
$page->setCellValue("F1", "img");
$s = 2;
$str = "<br>";
while($row = mysqli_fetch_array($query1))
{
$s++;
$page->setCellValue("A$s", $row['id']);
$page->setCellValue("B$s", $row['name']);
$page->setCellValue("C$s", $row['cost']);
$page->setCellValue("D$s", $row['description']);
$page->setCellValue("E$s", $row['ord']);
$page->setCellValue("F$s", $row['img']);
}
$page->setTitle("Example");
$objWriter = PHPExcel_IOFactory::createWriter($phpexcel, 'Excel2007');
$objWriter-> save( "otchet_" . date('Ymd') . ".xls");
?>