我必须用PHP查看pdf的内容。 尝试了很多我在互联网上找到的示例,但没有查看pdf的内容
我尝试使用此代码:
<?php
$filePath="pdffiles/";
$filename="2018-06-0343.pdf";
header('Content-type:application/pdf');
header('Content-disposition: inline; filename="'.$filename.'"');
header('content-Transfer-Encoding:binary');
header('Accept-Ranges:bytes');
@ readfile($filePath)
?>
我收到此错误,因为它在子文件中
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sample\main.php:77) in C:\xampp\htdocs\sample\pages\subfile.php on line 25
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sample\main.php:77) in C:\xampp\htdocs\sample\pages\subfile.php on line 26
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sample\main.php:77) in C:\xampp\htdocs\sample\pages\subfile.php on line 27
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sample\main.php:77) in C:\xampp\htdocs\sample\pages\subfile.php on line 28
是否有不使用标题即可查看PDF内容的最佳方法?