Hi all Tôi có một trang web và tôi muốn tạo một tập tin excel và lưu vào thư mục của tôi vào máy chủ của tôi. Tôi đã thử ở chế độ này nhưng mỗi lần yêu cầu tôi tải xuống. Tôi không muốn yêu cầu tải xuống vì sau khi tôi phải tạo nhiều xls là báo cáo và không cần tải xuống nhưng chỉ để lưu vào thư mục. Đây là mã của tôi:PHPExcel lưu tập tin
require_once 'inc/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("Alessandro Minoccheri")
->setLastModifiedBy("Alessandro Minoccheri")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Generazione report inverter")
->setKeywords("office 2007 openxml php")
->setCategory("");
// Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!')
->setCellValue('C1', 'Hello')
->setCellValue('D2', 'world!');
// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', 'Miscellaneous glyphs')
->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');
// Rename worksheet
$objPHPExcel->getActiveSheet()->setTitle('Simple');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Tôi cũng đã cố gắng:
$objWriter->save('namee.xls');
Nhưng một lần nữa yêu cầu tôi tải.
Tôi làm cách nào để giải quyết vấn đề này?
xóa 3 dòng tiêu đề –