質問編集履歴

2

ソース加筆

2017/02/24 01:20

投稿

enigumalu
enigumalu

スコア192

test CHANGED
File without changes
test CHANGED
@@ -15,3 +15,51 @@
15
15
  つめかえるとすれば、構造体のようになりクドイ気がしますし、
16
16
 
17
17
  API取得の配列から間引くとするとこれはこれでクドイきがしているので、大量の項目が取得出来てしまう場合のフロントに渡す良い処理結果をご教授いただければと思います。
18
+
19
+
20
+
21
+ 案1
22
+
23
+ ```
24
+
25
+ $response = curl_exec($curl);
26
+
27
+ $filtered = array_filter($response,’age’);
28
+
29
+ ```
30
+
31
+ 案2
32
+
33
+ ```
34
+
35
+ class Person{
36
+
37
+ private $personName = array();
38
+
39
+
40
+
41
+ public function setPrefix($prefix){
42
+
43
+ $this->personName['prefix'] = $prefix;
44
+
45
+ }
46
+
47
+ public function setGivenName($gn){
48
+
49
+ $this->personName['givenName'] = $gn;
50
+
51
+ }
52
+
53
+ /* etc... */
54
+
55
+ }
56
+
57
+ $response = curl_exec($curl);
58
+
59
+ $person = new Person();
60
+
61
+ $person->setPrefix($response['name1']);
62
+
63
+ $person->setGivenName($response['name2']);
64
+
65
+ ```

1

名称変更

2017/02/24 01:20

投稿

enigumalu
enigumalu

スコア192

test CHANGED
@@ -1 +1 @@
1
- 処理結果が大量にある場合フロントへ渡す情報項目
1
+ 取得情報が大量にある変数データ整理について
test CHANGED
File without changes