更新时间:2023-12-04 20:36:04
你可以试试这样的:
$file_name = 'file.avi';
$file_url = 'http://www.myremoteserver.com/' . $file_name;
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename="".$file_name.""");
readfile($file_url);
exit;
我刚刚测试了它,它对我有用.
I just tested it and it works for me.
请注意,要使 readfile
能够读取远程 url,您需要拥有 fopen_wrappers
已启用.
Please note that for readfile
to be able to read a remote url, you need to have your fopen_wrappers
enabled.