$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. | 関連モジュール | タイトル |
|---|---|---|---|
| 言語 | 7.15 | Language | まだ翻訳されていない英語文、どうにかならない? |
| テーマ | 7.15 | CSS Injector | 簡単にCSSを追加したい |
| コンテンツの管理 | 6.x | Views Flag Calendar | 空き室予約のような仕組みは実現できますか? |
| コンテンツの作成 | 6.x | Views | カルーセルのように回転するコンテンツを作りたい |
| アップデート | 7.15 | Webform Backup_and_Migrate | drupal7.12 -> drupal7.14アップデートメモ |
| フォーム | 7.15 | Webform | WebformのEntity Translation |
| フォーム | 7.15 | Webform | Webform - 確認ページの多言語化 |
| コンテンツの作成 | 7.15 | Automatic_Nodetitles Automatic_Entity_Label | ノード投稿フォームにタイトル入力フォームを表示しない方法 |