SOFTELメモ Developer's blog

【php】CSV出力のときのヘッダ

Category: php 2010/11/01

一例。

header('Cache-Control: public');
header('Pragma: public');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 1800) . ' GMT');
header('Content-Disposition: attachment; filename=' . date('Ymdhis') . '.csv');
header('Content-Length: ' . strlen($csv));
header('Content-Type: application/octet-stream');
echo $csv;

関連するメモ

コメント