2014-01-22 53 views

回答

1

首先下载:根据需要

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "URL HERE"); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

$output = curl_exec($ch); 

curl_close($ch); 

然后处理数据。之后:

header("Content-Disposition: attachment; filename=\"" . basename($File) . "\""); 
header("Content-Type: application/force-download"); 
header("Content-Length: " . filesize($File)); 
header("Connection: close"); 
+0

这是错误的,他需要从第三方网站下载文件,而不是从他自己的网站提供下载。 –

+0

+1 - 我编辑了这个帖子,让我删除downvote,现在答案是正确的 –

+0

谢谢没问题。 – KBeckers