Home > php教程 > php手册 > body text

现在知道的下载功能

WBOY
Release: 2016-06-07 11:40:54
Original
1155 people have browsed it

我现在说知道的下载,还有什么补充的吗?例如用迅雷而不是浏览器下载
public function download(){
$file_id=$_GET['file_id'];
if($file_id=="") {
$this->error('没有找到文件');
} else{
$file=D('File');
$result= $file->find($file_id);//根据id查询到文件信息
if($result==false)
{$this->error('没有该文件');
}

$filename=$file->file_path;//完整文件名(路径加名字)
$extName=end(explode('.',$filename)); //截取后缀名
$showname=$file->file_name;//文件原名
$downname=$showname.'.'.$extName;
import('ORG.Net.Http');
Http::download($filename,$downname);

}
}

然后是主要html代码
下载

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template