How can different Content-Types affect the download of RTF files in PHP?

Different Content-Types can affect the download of RTF files in PHP because the browser may not recognize the file type correctly and may not prompt the user to download the file. To ensure proper downloading of RTF files, you can set the Content-Type header to "application/rtf" before outputting the file contents.

<?php
$file = 'example.rtf';

header('Content-Type: application/rtf');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
readfile($file);