这个可以用的啊,关键是要设置好$serverPath

解决方案 »

  1.   

    自己解决了function sendFile($serverPath, $filename, $mimeType = 'application/octet-stream')
    {
    header("Content-Type: {$mimeType}");
    $filename = '"' . urlencode($filename) . '"';
    header("Content-Disposition: attachment; filename={$filename}");
    header('Expires: 0');
    header('Pragma: cache');
    header('Cache-Control: private');
    readfile($serverPath);
    exit;
    }
      

  2.   

    header()里面的参数你是在哪里学到的啊,崇拜啊!