只需要如下的简单的代码,就可以实现高性能的文件下载,原理很简单..就是linux的”零拷贝”特性..也无非就是sendfile的API的使用问题
header("Content-Disposition:attachment;filename= \"{$filename}\""); header("X-LIGHTTPD-send-file: ".$path);
$path是啥?服务器上的路径吗? 这样会不会暴露服务器路径呢
Reply
小路 reply on 三月 3rd, 2008:
你可以用相对路径试试,这我没试验过…另外..response我也没有试过截获过,据说是不会生成X-LIGHTTPD-send-file: 的response
你若试过了,请把信息反馈给我,呵呵
$path是服务器的绝对路径没错..
Name (required)
Mail (will not be published) (required)
Website
Comment spam protected by SpamBam
You will not be able to post a comment. Javascript is required.
$path是啥?服务器上的路径吗?
这样会不会暴露服务器路径呢
Reply
小路 reply on 三月 3rd, 2008:
你可以用相对路径试试,这我没试验过…另外..response我也没有试过截获过,据说是不会生成X-LIGHTTPD-send-file: 的response
你若试过了,请把信息反馈给我,呵呵
Reply
小路 reply on 三月 3rd, 2008:
$path是服务器的绝对路径没错..
Reply