正如标题所说,我制作了一个脚本来读取 pdf 文件。只能打开特定文件。可以打开最后修改到 2008 年 9 月 29 日的所有文件。之后的所有文件都不能。
这是我的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Stienser Omroeper</title>
</head>
<body>
<?php
$file = 'E:/Omrop/'.$_GET['y'].'/'.$_GET['f'];
$filename = $_GET['f'];
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
@readfile($file);
?>
</body>
</html>
$_GET 包含 y(地图结构的年份)和 f(文件名)。如果我在我的电脑上回显 $file 并使用运行中的链接,它会完美运行。在浏览器中,我收到消息此文件已损坏,无法修复..
任何人的想法?