📜  使用php header函数在浏览器中查看pdf文件 - PHP代码示例

📅  最后修改于: 2022-03-11 14:53:57.795000             🧑  作者: Mango

代码示例1
$file = 'headerPdfFile.pdf';

$filename = 'IamPdfFile.pdf';
  
// Header content type
header('Content-type: application/pdf');
  
header('Content-Disposition: inline; filename="' . $filename . '"');  
  
// Read the file
@readfile($file);