使用header下载文件
想等下载完成后跳转到其他页面怎么做啊down.php
header部分如下
header("Cache-control: private");
header("Content_Type: application/x-doc");
header("Content-Disposition: attachment; filename=".$DB -> RConn["AFileNum"][0].".doc");
readfile($newFile);页面的载入过程如下
main.php页面单击按钮(使用top.location.href=....做的)进入down.php.
我想等待下载完成后跳转回index页面
现在下载完成后留在main.php页面一个空白,刷新后才能到index页面,不知道这期间可以怎么弄

解决方案 »

  1.   

    header('location:index.php');不行么?
      

  2.   

    php跳转必须是在没有向用户浏览器发送数据的情况下才可以,你这种方法好像不能做到你的想法
      

  3.   

    不太会做
    header(location...不行)
      

  4.   


    header("Cache-control: private"); 
    header("Content_Type: application/x-doc"); 
    header("Content-Disposition: attachment; filename=".$DB -> RConn["AFileNum"][0].".doc"); 
    $rs=readfile($newFile); 
    if($rs){
    echo '<script>alert("下载完成");window.location=index.php;</script>';
    }else{
    echo '<script>alert("下载失败");window.location=index.php;</script>';
    }