时间:2021-07-01 10:21:17 帮助过:7人阅读
function indexAction()
{
$file_dir = @$_POST["dir"]; //文件路径为当前目录
$file_name = @$_POST["file_name"]; //文件名
$file=$file_dir.$file_name;
//$file="/var/www/test11.txt";
$this->view->downfile = $file;
echo $this->view->render('download/download.phtml');
}
$file = $this->downfile;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
//$file = $this->downfile;
else{echo $file.'ssa';}