質問編集履歴
1
変更しました!
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,7 +60,53 @@
|
|
60
60
|
|
61
61
|
|
62
62
|
|
63
|
-
|
63
|
+
```php
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
function GetNewmaster($human_number){
|
68
|
+
|
69
|
+
global $USER_NAME;
|
70
|
+
|
71
|
+
global $PASS;
|
72
|
+
|
73
|
+
global $SERVER_NAME;
|
74
|
+
|
75
|
+
$ConnectOracle = ConnectOracle($USER_NAME, $PASS, $SERVER_NAME);
|
76
|
+
|
77
|
+
//品番抜き出しsql
|
78
|
+
|
79
|
+
$PersonalDate_sql = "select * from TEST where id ='" . $human_number . "' ORDER BY workday DESC";
|
80
|
+
|
81
|
+
//UTF-8からSJISにエンコード
|
82
|
+
|
83
|
+
$PersonalDate_sql = mb_convert_encoding($PersonalDate_sql, "sjis-win", "utf-8");
|
84
|
+
|
85
|
+
//oracle → parse
|
86
|
+
|
87
|
+
$id = oci_parse($ConnectOracle, $PersonalDate_sql);
|
88
|
+
|
89
|
+
//oracle → execute
|
90
|
+
|
91
|
+
oci_execute($id);
|
92
|
+
|
93
|
+
while ($row = oci_fetch_array($id, OCI_ASSOC + OCI_RETURN_NULLS)) {
|
94
|
+
|
95
|
+
$row = mb_convert_encoding($row, "utf-8", "sjis-win");
|
96
|
+
|
97
|
+
$Result[] = $row;
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
//oracle → 接続クローズ
|
102
|
+
|
103
|
+
oci_close($ConnectOracle);
|
104
|
+
|
105
|
+
return $Result;
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
64
110
|
|
65
111
|
if($_REQUEST["csv_get"]){
|
66
112
|
|
@@ -70,7 +116,7 @@
|
|
70
116
|
|
71
117
|
$data = GetNewmaster($number);
|
72
118
|
|
73
|
-
$fp = fopen('
|
119
|
+
$fp = fopen('test.csv', 'w');
|
74
120
|
|
75
121
|
foreach ($data as $line) {
|
76
122
|
|
@@ -80,13 +126,13 @@
|
|
80
126
|
|
81
127
|
fclose($fp);
|
82
128
|
|
83
|
-
$filepath = 's
|
129
|
+
$filepath = 'test.csv';
|
84
130
|
|
85
131
|
header('Content-Type: application/octet-stream');
|
86
132
|
|
87
133
|
header('Content-Length: '.filesize($filepath));
|
88
134
|
|
89
|
-
header('Content-Disposition: attachment; filename=
|
135
|
+
header('Content-Disposition: attachment; filename=test.csv');
|
90
136
|
|
91
137
|
// ファイル出力
|
92
138
|
|
@@ -98,4 +144,6 @@
|
|
98
144
|
|
99
145
|
|
100
146
|
|
147
|
+
```
|
148
|
+
|
101
149
|
ご教授よろしくお願い致します。
|