你之前调用了header的缘故.....

解决方案 »

  1.   

    <?php
    if ($downfile) {
        
            if (!@is_file($downfile))
                echo"你要下的文件不存在";
            $filename = basename($downfile);
            $filename_info = explode('.', $filename);
            $fileext = $filename_info[count($filename_info)-1];
            header('Content-type: application/x-'.$fileext);
            header('Content-Disposition: attachment; filename='.$filename);
            //header('Content-Description: PHP3 Generated Data');
            readfile($downfile);
            
                         echo"你已经下载完";
        }?>
    会不会执行呢?
      

  2.   

    1、下载文件的进度由浏览器的下载进度框表示。
    2、你最后输出的
    <script>
    alert('你要下载文件,文件已下载完毕!');    
    </script>
    被保存到了下载文件中,若是非文本文件则可能打不开了
      

  3.   

    1、下载文件的进度由浏览器的下载进度框表示。
    2、你最后输出的
    <script>
    alert('你要下载文件,文件已下载完毕!');    
    </script>
    被保存到了下载文件中,若是非文本文件则可能打不开了
      

  4.   

    果然被保存进来了!
    这样行吗?<?php
    if ($downfile) {
        
            if (!@is_file($downfile))
                echo"你要下的文件不存在";
            $filename = basename($downfile);
            $filename_info = explode('.', $filename);
            $fileext = $filename_info[count($filename_info)-1];
            header('Content-type: application/x-'.$fileext);
            header('Content-Disposition: attachment; filename='.$filename);
            //header('Content-Description: PHP3 Generated Data');
            readfile($downfile);
            
            几句数据库操作的语句;
        }?>
      

  5.   

    不行!header前不能输出到屏幕内容
      

  6.   

    回复人: okdw(零零发财) ( ) 信誉:100 
    不行!header前不能输出到屏幕内容我没有再header()前输出语句!
      

  7.   

    <?php
    if ($downfile) {
        
      if (!@is_file($downfile))
        echo"你要下的文件不存在";
      else {      
            $filename = basename($downfile);
            $filename_info = explode('.', $filename);
            $fileext = $filename_info[count($filename_info)-1];
            header('Content-type: application/x-'.$fileext);
            header('Content-Disposition: attachment; filename='.$filename);
            //header('Content-Description: PHP3 Generated Data');
            readfile($downfile);
            
            几句数据库操作的语句;
        }
    }
    ?>
      

  8.   

    <?php
    if ($downfile) {
        
      if (!@is_file($downfile))
        echo"你要下的文件不存在";
      else {      
            $filename = basename($downfile);
            $filename_info = explode('.', $filename);
            $fileext = $filename_info[count($filename_info)-1];
            header('Content-type: application/x-'.$fileext);
            header('Content-Disposition: attachment; filename='.$filename);
            //header('Content-Description: PHP3 Generated Data');
            readfile($downfile);
            
            几句数据库操作的语句;
        }
    }
    ?>
      

  9.   

    xuzuning(唠叨):
    请将一下看不懂,你的改动!
    谢谢!
      

  10.   

    <?php
    if ($downfile) {
        
      if (!@is_file($downfile))
        echo"你要下的文件不存在";
      else {      
            $filename = basename($downfile);
            $filename_info = explode('.', $filename);
            $fileext = $filename_info[count($filename_info)-1];
            header('Content-type: application/x-'.$fileext);
            header('Content-Disposition: attachment; filename='.$filename);
            header('Content-Description: PHP3 Generated Data');
            readfile($downfile);
            
            $q="INSERT INTO `dcms_temp_dispatch` ( `dispatch_id` , `user_id` ,              `dispatch_num` , `dis_time` ) 
    VALUES (
    '6', '1', '1', '0000-00-00 00:00:00'
    );
    ";
    $sql->query($q);
    exit;
        }
    }
    ?>
    这样数据库的操作中与执行了
      

  11.   

    不过:
    header('Content-Description: PHP3 Generated Data');这具有什么用?