グーグル検索中に、異なるファイル形式で生成された Excel を出力するときに設定する必要がある 2 つの異なるヘッダー セットが見つかりました。
例えば
タイプ「Excel5」のヘッダーは次のとおりです。
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=$filename");
header("Content-Transfer-Encoding: binary ");
タイプ「Excel2007」のヘッダーは次のとおりです。
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="myfile.xlsx"');
header('Cache-Control: max-age=0');
私の質問: CSV、HTML、PDFなどの他のファイル タイプがあるため、ファイル タイプごとに異なるヘッダーを設定する必要がありますか?