$path = ファイルへのパス; $basename = basename($path); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Transfer-Encoding: binary"); header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="' . $basename . '"'); header('Content-Length: ' . filesize($path)); header('Cache-Control: max-age=0'); $result = readfile($path); exit();
とにかく何でもコンテンツをダウンロードさせる方法
OTHER FAQ
カテゴリ | Core Ver. | 関連モジュール | タイトル |
---|---|---|---|
コンテンツの作成 | 8.9.x | Display sweet, Views, Twig Tweak, Views field formatter | テーマに頼らず コンテンツのフィールドとしてViewsを埋め込み表示する方法 |
サイトの構築 | 8.9.x | Webform | drupalを使用した登録、一覧表示の方法について |
アップデート | 8.9.x | Composer update | composer update するときに パッチが必要なモジュールが更新されパッチが消えてしまうことへ対応する方法 |
サイト情報 | 8.9.x | api | Drupal::request() メモ |
フォーム | 8.9.x | api | GET/POSTされた情報を得る方法 |
コンテンツの管理 | 8.9.x | 写真の変更を行いたい | |
Migrate | 9.x | drush config | Upgrade source(環境) を 変更したときにやるべきこと |