What are the potential issues with sending multiple headers in PHP for file downloads?

Sending multiple headers for file downloads in PHP can lead to conflicts and unexpected behavior. To avoid this issue, make sure to send only one header for each type of information (e.g., content type, content-disposition). If you need to send multiple headers, you can concatenate them into a single header using the PHP header() function.

<?php
$file = 'example.pdf';
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile($file);
exit;
?>