LoginSignup
0

More than 5 years have passed since last update.

posted at

updated at

SafariからPHPExcel、CSVでファイルをダウンロードすると.htmlになってしまう。

CSVの場合は、viewを以下のようにする。

PHPExcel
<?php
$this->Csv->addRow($row);
echo $this->Csv->render(true, 'sjis-win', 'utf-8');
exit;//この一行を足す

参考:http://norm-nois.com/blog/archives/2416

PHPExcelの場合は、viewを以下のようにする。

CSV
<?php
$writer->save('php://output');
exit;//この1行を足す

参考:http://phpjp.info/?PHPExcel%20Excel%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E4%BD%9C%E6%88%90

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0