私のコードは次のとおりです。
readfile('cls_ref.csv');
fclose($fp);
$file_type = 'octet-stream';
$file_name = "cls_ref_" . date('m-d-Y H:i');
$file_ending = "csv";
header("Content-Type: application/$file_type; charset=utf-8");
header("Content-Disposition: attachment; filename=$file_name.$file_ending");
header("Pragma: no-cache");
header("Expires: 0");
header("Location:index.php");
ダウンロード後にリダイレクトしたいのですが、ダウンロードindex.php
前にリダイレクトされます。
ファイルの最後にコードを記述しましたheader("Location:index.php");
が、ファイルをダウンロードする前にリダイレクトされます。
そのための解決策はありますか?