创建一个php文件
复制代码 代码如下:
<?php
$file = $_get['file'];
$arr = explode('/',$file);
header('content-type: application/pdf');
header('content-disposition: attachment; filename="'.array_pop($arr).'"');
readfile(file);
?>
加入代码,通过这个把pdf路径转换成浏览器认识的语言,告诉浏览器
列子 /upload.php?file=/aa/aa.pdf
这样就可以不管是什么,都会下载,而不是打开
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!