|
ブラウザの種類によって処理を変更する必要あり <?php
$down_file = 'download.xls';
$down_name = 'ダウンロード';
// IE
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') > 0) {
$down_name = urlencode(mb_convert_encoding($down_name, 'UTF-8', 'EUC-JP'));
}
// Firefox他
else {
$down_name = mb_encode_mimeheader($down_name, 'UTF-8', 'B');
}
header ("Content-type: text/octet-stream");
header ("Content-disposition: attachment; filename={$down_name}.xls");
header ("Content-Length: ".filesize($down_file));
ob_end_flush();
readfile($down_file);
exit();
?>
完全に対応できるかどうかは不明 |