//下载文件
public function download(Request $request){
$file_path = 'C:/Users/Admin/Desktop/办公材料/缓存.txt';
$file_name = '缓存.txt';
if (!file_exists($file_path)) {
echo '文件不存在';
exit();
}
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename='.$file_name);
readfile($file_path);
}
php 点击下载文件
发布时间 2023-11-06 17:23:42作者: 萌妹子的vlog