$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. | 関連モジュール | タイトル |
---|---|---|---|
Commerce2 | 8.6.x | Commerce Shipment | Commerceで配送情報を得る方法 |
Commerce | 8.6.x | Commerce Payment Gateway | オリジナルCommerce決済モジュール(Offsite)で決済サーバーへのPOST時のエンコードを変更する方法 |
Commerce | 8.6.x | Commerce Payment Order | Commerceで歴代購入数/金額を集計する方法 |
Commerce | 7.34 | Commerce kickstart, Commerce file | Commerceモジュール利用時のダウンロード製品登録方法 |
CentOS | 7.50 | 消せないファイルを消すには | |
Calendar | 7.34 | Calendar | CalendarモジュールとGoogleカレンダーを同期するには |
Apache2.4 | 7.50 | Apache2.4のアクセス制限 |