質問するログイン新規登録

回答編集履歴

2

コードの修正

2016/09/26 18:34

投稿

nnssn
nnssn

スコア1221

answer CHANGED
@@ -7,9 +7,9 @@
7
7
 
8
8
  public function after($response)
9
9
  {
10
- $json_string = (string)$response;
10
+ $json = (string)$response;
11
- $json = json_decode($json_string, true);
11
+ $array = json_decode($json, true);
12
- $res = ")]}'," . json_encode($json[1]);
12
+ $res = ")]}'," . json_encode($array[1]);
13
13
  return \Response::forge($res);
14
14
  }
15
15
  ```

1

不要データを除去

2016/09/26 18:34

投稿

nnssn
nnssn

スコア1221

answer CHANGED
@@ -7,11 +7,13 @@
7
7
 
8
8
  public function after($response)
9
9
  {
10
+ $json_string = (string)$response;
11
+ $json = json_decode($json_string, true);
10
- $res = ")]}'," . (string)$response;
12
+ $res = ")]}'," . json_encode($json[1]);
11
- return Response::forge($res);
13
+ return \Response::forge($res);
12
14
  }
13
15
  ```
14
16
  responseメソッドを通してフォーマットされたオブジェクトを一旦文字列化して、
15
17
  再度Responseオブジェクトに詰めて返すで出来ました。
16
- Controller_Restのafterを無視していたり、余計なデータがくっついてたりしていますが
18
+ Controller_Restのafterを無視していますが、JSON Vulnerability Protectionを
17
- JSON Vulnerability Protectionを確認するため一時的になら問題ないかと。
19
+ 確認するため一時的になら問題ないかと。