質問編集履歴
1
追記あり
test
CHANGED
File without changes
|
test
CHANGED
@@ -47,3 +47,39 @@
|
|
47
47
|
readfile($filepath);
|
48
48
|
|
49
49
|
```
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
[追記]
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
以下の方法でやると、HTML文が全文出た後に出力予定のcsvファイルの中身が
|
58
|
+
|
59
|
+
出力されました。
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
```php
|
64
|
+
|
65
|
+
// ファイルのパス
|
66
|
+
|
67
|
+
$filepath = 'test.csv';
|
68
|
+
|
69
|
+
// リネーム後のファイル名
|
70
|
+
|
71
|
+
$filename = 'テスト.csv';
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
header('Content-Description: File Transfer');
|
76
|
+
|
77
|
+
header("Content-Disposition: attachment; filename=$filename");
|
78
|
+
|
79
|
+
header('Content-Type: application/force-download;');
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
readfile($filepath);
|
84
|
+
|
85
|
+
```
|