-2

私はこのJSONを持っています

{
   "count":"3",
   "num":"1",
   "array":[
      {
         "id":"a_a",
         "amount":56,
         "duration":"0:12",
         "time":1234566,
         "type":0
      },
      {
         "id":"a_a",
         "amount":56,
         "duration":"0:12",
         "time":1234566,
         "type":1
      }
   ]
}

Androidで作成し、**HttpPost**

、私はphpでデータを取得するために多くの方法を試しました.phpファイルはこれです:

<?php
    $response = array();
//$json_data = json_encode(stripslashes($_POST['jsonarray']))

    $josn = file_get_contents("php://input");
    $json_data = json_decode($josn,true);

    $count = $json_data->{'count'};
    $num = $json_data["num"];

     $response["data"]=$count;
     $response["data2"]=$num;
        // echoing JSON response
        echo json_encode($response);
?>

しかし$count$num常にnullを返します。助けてください。感謝します。

4

1 に答える 1