本文共 328 字,大约阅读时间需要 1 分钟。
这样点击下载 会直接打开pdf预览,需要做的是直接弹出下载框进行下载
主要原因是因为文件的请求头部的问题,需要设置一下头部 可以通过php后端做转发设置一下php 接口代码
$url = $this->request->query['url'];$name = $this->request->query['name'];header('Content-type: application/pdf');header('Content-Disposition: attachment; filename="' . $name . '"');echo file_get_contents($url);