站在巨人的肩膀上,我已经成功拼凑了一个脚本,使用 header() 在我的内网发布 pdf 文档,
我的显示代码:
<?php
require_once "includes/IniFile.php";
include_once "includes/process.php";
$MyData['ini'] = IniFile::getSettings();
foreach ( $_POST as $key => $value )
{ $fn = $key; }
$fn = str_replace("|sp|"," ",$fn);
$fn = str_replace("|dt|",".",$fn);
$ed = explode('!',$fn) ;
$MyData['ini']['pathMask'] = str_replace('|DEPT|', dptdir($ed[1], $MyData['ini'] ['departments']), $MyData['ini']['pathMask']);
$MyData['ini']['pathMask'] = str_replace('|FLDR|', subdir($ed[2], $MyData['ini'] ['folders']), $MyData['ini']['pathMask']);
$fn ='';
$file = $MyData['ini']['pathMask'].$ed[0];
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="'.$fn.'"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
@readfile($file);
?>
一切正常,但我希望包含 .pdf 的新页面有一个与正在发布的文档名称相对应的 <title>。
这可能吗?
谢谢 - 克里斯。