0
ヘッダー( "location:index.php");私のために働いていません。PHPを使用してサーバーからファイルをダウンロードした直後に任意のURLにリダイレクト
$ fileはファイルのパスです。
if (file_exists($file)) {
header('Content-Description: File Transfer');
//header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
header("Content-Type: application/force-download");
readfile($file);
header("location:index.php");
exit;
}
私はあなたが得ているエラーを表示します... –
私はob_start();を追加することによって解決された同様の問題を抱えていました。およびob_end_flush(); – Dave
javascriptの 'window.location =" http://www.yoururl.com ";を使ってみることができます; –