Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 4, 2019 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4e54c90bbe80b5e90c8cdad14a61aa10 to your computer and use it in GitHub Desktop.
Save parzibyte/4e54c90bbe80b5e90c8cdad14a61aa10 to your computer and use it in GitHub Desktop.
#<?php
// Redirect output to a client’s web browser (Xlsx)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="01simple.xlsx"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment