使用标题下载文件后重定向

时间:2014-05-26 04:53:17

标签: javascript php

我只想在下载文件后重定向页面,我使用两种方法重定向1- javascript 2-标题,但没有任何对我有用,我的代码是

<?php

$packPath = $_REQUEST['packPath'];

   header('Content-Description: File Transfer');
   header('Cache-Control: public');
   header('Content-Type: application/zip');
   header("Content-Transfer-Encoding: binary");
   header('Content-Disposition: attachment; filename='. basename($packPath));
   header("Content-Length: " .(string)(filesize($packPath)) );
   ob_clean(); #THIS!
   flush();
   readfile($packPath);

  // header('Location: ' . $_POST['accept']);
   echo '<script type="text/javascript">
          window.location.href="'.$_POST['accept'].'";
      </script>'; */
exit;
?>

0 个答案:

没有答案