回答編集履歴
2
修正
test
CHANGED
@@ -112,6 +112,10 @@
|
|
112
112
|
|
113
113
|
$test = new Test($id, $name, $array);
|
114
114
|
|
115
|
+
print_r($test->sayId("value2"));//id -> 2
|
116
|
+
|
117
|
+
print_r($test->sayName("1"));//name -> value1
|
118
|
+
|
115
119
|
}
|
116
120
|
|
117
121
|
}
|
@@ -160,9 +164,9 @@
|
|
160
164
|
|
161
165
|
<div class="box">
|
162
166
|
|
163
|
-
<label><input type="number" name="testArray[id]"></label>
|
167
|
+
<label><input type="number" name="testArray[id][<?= $i ?>]" value="<?= $i ?>"></label>
|
164
168
|
|
165
|
-
<label><input type="text" name="testArray[name]"></label>
|
169
|
+
<label><input type="text" name="testArray[name][<?= $i ?>]" value="<?= "value" . $i ?>"></label>
|
166
170
|
|
167
171
|
</div>
|
168
172
|
|
@@ -176,6 +180,4 @@
|
|
176
180
|
|
177
181
|
</html>
|
178
182
|
|
179
|
-
|
180
|
-
|
181
183
|
```
|
1
修正
test
CHANGED
@@ -96,8 +96,6 @@
|
|
96
96
|
|
97
97
|
if (array_key_exists("id", $array)) {
|
98
98
|
|
99
|
-
print_r($array["id"]);
|
100
|
-
|
101
99
|
$id = $array["id"];
|
102
100
|
|
103
101
|
}
|
@@ -105,8 +103,6 @@
|
|
105
103
|
|
106
104
|
|
107
105
|
if (array_key_exists("name", $array)) {
|
108
|
-
|
109
|
-
print_r($array["name"]);
|
110
106
|
|
111
107
|
$name = $array["name"];
|
112
108
|
|