質問編集履歴
3
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,15 @@
|
|
12
12
|
|
13
13
|
```
|
14
14
|
|
15
|
+
Warning: session_start(): Session cannot be started after headers have already been sent in /Applications/MAMP/htdocs/create_file/test.php on line 2
|
16
|
+
|
17
|
+
|
18
|
+
|
15
|
-
Warning: Undefined variable $
|
19
|
+
Warning: Undefined variable $_SESSION in /Applications/MAMP/htdocs/create_file/test.php on line 4
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
Warning: Trying to access array offset on value of type null in /Applications/MAMP/htdocs/create_file/test.php on line 4
|
16
24
|
|
17
25
|
```
|
18
26
|
|
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -130,21 +130,67 @@
|
|
130
130
|
|
131
131
|
//template.php
|
132
132
|
|
133
|
+
|
134
|
+
|
135
|
+
<!DOCTYPE html>
|
136
|
+
|
137
|
+
<html>
|
138
|
+
|
139
|
+
<head>
|
140
|
+
|
141
|
+
<meta charset="UTF-8">
|
142
|
+
|
143
|
+
<title>テスト</title>
|
144
|
+
|
145
|
+
</head>
|
146
|
+
|
147
|
+
<body>
|
148
|
+
|
149
|
+
<h1><?php include('./test.php'); ?></h1>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
</body>
|
154
|
+
|
155
|
+
</html>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
//data.php
|
166
|
+
|
133
167
|
<?php
|
134
168
|
|
135
|
-
|
136
|
-
|
137
|
-
if ($_SERVER['REQUEST_METHOD'] === 'POST'){
|
138
|
-
|
139
|
-
|
169
|
+
session_start();
|
140
|
-
|
170
|
+
|
141
|
-
|
171
|
+
// セッション情報の保存
|
172
|
+
|
142
|
-
|
173
|
+
if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
$data = [];
|
178
|
+
|
143
|
-
|
179
|
+
$data = $_POST['data'];
|
180
|
+
|
144
|
-
|
181
|
+
$_SESSION['name'] = $data["name"];
|
182
|
+
|
183
|
+
|
184
|
+
|
145
|
-
|
185
|
+
$kanto = array(
|
186
|
+
|
146
|
-
|
187
|
+
$data["name"] => $data
|
188
|
+
|
189
|
+
);
|
190
|
+
|
191
|
+
|
192
|
+
|
147
|
-
|
193
|
+
};
|
148
194
|
|
149
195
|
|
150
196
|
|
@@ -154,71 +200,25 @@
|
|
154
200
|
|
155
201
|
|
156
202
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
<!DOCTYPE html>
|
162
|
-
|
163
|
-
<html>
|
164
|
-
|
165
|
-
<head>
|
166
|
-
|
167
|
-
<meta charset="UTF-8">
|
168
|
-
|
169
|
-
<title><?php echo $name ;?></title>
|
170
|
-
|
171
|
-
</head>
|
172
|
-
|
173
|
-
<body>
|
174
|
-
|
175
|
-
<h1><?php echo $name ;?></h1>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
</body>
|
180
|
-
|
181
|
-
</html>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
```
|
203
|
+
```
|
186
|
-
|
187
|
-
|
188
|
-
|
204
|
+
|
205
|
+
|
206
|
+
|
189
|
-
```
|
207
|
+
```
|
190
|
-
|
208
|
+
|
191
|
-
//
|
209
|
+
//test.php
|
192
210
|
|
193
211
|
<?php
|
194
212
|
|
195
|
-
session_start();
|
213
|
+
session_start();
|
196
|
-
|
197
|
-
|
214
|
+
|
198
|
-
|
199
|
-
|
215
|
+
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
216
|
+
|
204
|
-
|
205
|
-
$
|
217
|
+
$name = $_SESSION['name'];
|
206
|
-
|
207
|
-
|
218
|
+
|
208
|
-
|
209
|
-
|
210
|
-
|
219
|
+
|
220
|
+
|
211
|
-
$
|
221
|
+
echo $name;
|
212
|
-
|
213
|
-
$data["name"] => $data
|
214
|
-
|
215
|
-
);
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
};
|
220
|
-
|
221
|
-
|
222
222
|
|
223
223
|
|
224
224
|
|
1
POSTをGETに変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -196,7 +196,7 @@
|
|
196
196
|
|
197
197
|
// セッション情報の保存
|
198
198
|
|
199
|
-
if($_SERVER['REQUEST_METHOD'] === '
|
199
|
+
if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
200
200
|
|
201
201
|
|
202
202
|
|