headerfunction sendFile($serverPath, $filename, $mimeType = 'application/octet-stream')
{
header("Content-Type: {$mimeType}");
$filename = '"' . urlencode($filename) . '"';
header("Content-Disposition: attachment; filename={$filename}");
header("X-Sent-By: Xtra_Helper_SendFile");
readfile($serverPath);
exit;
}
{
header("Content-Type: {$mimeType}");
$filename = '"' . urlencode($filename) . '"';
header("Content-Disposition: attachment; filename={$filename}");
header("X-Sent-By: Xtra_Helper_SendFile");
readfile($serverPath);
exit;
}
header("X-Sent-By: Xtra_Helper_SendFile");这行不要,这个是我自己的库的东西
header("Content-Disposition: attachment; filename={$filename}");
我试了下,下载的是当前的url。是我不会用吧,望讲的详细点,谢谢