
En-têtes PHP et types MIME populaires
même si l'extension d'un fichier se termine par PHP, vous pouvez toujours indiquer au navigateur que vous utilisez un type de contenu différent. Voici quelques-uns des types de contenu les plus populaires utilisés sur Internet.
Atom
header('Content-Type: application/atom+xml' charset=UTF-8');
CSS
header('Content-Type: text/css' charset=UTF-8');
CSV
header("content-type:application/csv;charset=UTF-8");
EXCEL
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
ou
header("Content-type: application/x-msexcel; charset=utf-8");
Javascript
header('Content-Type: text/javascript' charset=UTF-8');
JPEG Image
header('Content-Type: image/jpeg' charset=UTF-8');
JSON
header('Content-Type: application/json' charset=UTF-8');
header('Content-Type: application/pdf' charset=UTF-8');
RSS
header('Content-Type: application/rss+xml; charset=UTF-8');
Text (Plain)
header('Content-Type: text/plain' charset=UTF-8');
XML
header('Content-Type: text/xml' charset=UTF-8');