0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CakePHP3.6でcsvをダウンロードする

Posted at
code
download.php
$this->response = $this->response
    ->withType('csv')
    ->withHeader('Content-Disposition', 'attachment')
    ->withDownload('file.csv');
ver

PHP 7.4.10
CakePHP 3.6.15

about

【PHP】【CakePHP】CSVダウンロード - Qiita
【CakePHP】ファイルダウンロード - Qiita
あたりを読んで、動かない動かないとハマっていたので。
v3.4からメソッド名が一新されていた。

reference

CakePHP3.4が PSR-7に対応していた話(と、ミドルウェアの話) | バシャログ。
3.4 移行ガイド - 3.9
リクエストとレスポンスオブジェクト - 3.9

0
0
1

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
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?