public function download($currdir = null){
???$file = urldecode($currdir);
???$file = iconv(‘UTF-8‘, "GB2312", $file);
???if (!file_exists($file)) {
???????$this->error("文件不存在");
???}
???//basenamecn 是common文件自定义的方法
???$filename = basenamecn(iconv(‘GB2312‘, "UTF-8", $file));
???//告诉浏览器以附件处理
???header(‘Content-Disposition: attachment;filename=‘ . $filename);
???readfile($file);
}
PHP、thinkPHP5.0开发网站文件管理功能(四)下载文件
原文地址:https://www.cnblogs.com/YAN-HUA/p/9083734.html