【发布时间】:2013-10-22 18:43:13
【问题描述】:
我正在使用以下功能下载 pdf 文件,当我从 PC 或笔记本电脑下载它时它工作正常,但是当我使用 ipad 单击下载链接时,它会打开一个包含许多特殊字符的页面,我无法下载文件。
我的下载功能是
public function download() {
$download_path = $_SERVER['DOCUMENT_ROOT'] . "/import";
$filename = $_GET['file'];
$file = str_replace("..", "", $filename);
$file = "$download_path/$file";
if (!file_exists($file))
die("Sorry, the file doesn't seem to exist.");
$type = filetype($file);
header("Content-type: $type");
header("Content-Disposition: attachment;filename=$filename");
header('Pragma: no-cache');
header('Expires: 0');
readfile($file);
}
关于这个错误的任何想法?
【问题讨论】:
-
确保字符集匹配
-
字符集应该是什么?我正在使用 utf-8
-
确保您的 iPad 也看到了这些内容。
-
如何确定?
-
这似乎很不安全......
标签: php ipad codeigniter