What potential issues can arise when using the Content-disposition header in PHP to display PDF files?
Potential issues that can arise when using the Content-disposition header in PHP to display PDF files include the file not being displayed correctly due to incorrect encoding or the browser not recognizing the file type. To solve this, you can set the Content-type header to 'application/pdf' along with the Content-disposition header.
<?php
$file = 'example.pdf';
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $file . '"');
readfile($file);
exit;
?>