0
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

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

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
0
Help us understand the problem. What are the problem?